Focal Point
[Solved] Maintain -- A mini-Maintain inside a Focexec: write to an amper variable?

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/358108351

June 17, 2009, 10:55 AM
John_Edwards
[Solved] Maintain -- A mini-Maintain inside a Focexec: write to an amper variable?
Hey folks!

One of my top people brought me a question that I can't quite find an answer to. She has very complicated calculations that she needs to make prior to running a report, and I recommended using a small chunk of Maintain inside her Focexec to do the dirty work. We can calculate the values in Maintain with ease, but how do we get them into the TABLE FILE calls that follow?

Before telling her to write to a temporary table I thought I'd ask if anyone has a way to take variables in Maintain and turn them into amper variables for use farther down the routine. Needless to say, both of us are all ears.

J.

This message has been edited. Last edited by: John_Edwards,



June 17, 2009, 11:50 AM
Dave Ayers
John,

Just a quick thought...

You could pass the calculation results as variables to an EXEC'd focexec which could then -WRITE them to a file, which could then be retrieved as &Vars with a -READ


Regards,
Dave

http://www.daveayers.com

WebFocus/Maintain 7.6.4-8
on Win2000 and 2003 Server
June 17, 2009, 12:07 PM
Maintain Wizard
John
You will have to set up some kind of table, whether flat (using -READ / -WRITE) or focus / relational (using INCLUDE / PRINT). If flat, you can place the Filedef in the EDASPROF.

The problem is, when you EXEC a procedure, you are starting a different agent so you can't set & or && variables and expect them to be available when you return. Also, while you can EXEC a TABLE from the Maintain procedure, the output is not displayed.

Mark
June 17, 2009, 12:39 PM
John_Edwards
I have all of this in a single Focexec folks -- One after the other. All that is missing is digging the value out of the Maintain variable and getting it to the FOCUS that follows. I was hoping not to write to a table and then read (or join), but that appears to be the option available.

J.



June 17, 2009, 01:06 PM
Alan B
John

Do you mean something like:
APP FI MYVAL DISK BASEAPP/MYVAL.TXT
-RUN
MAINTAIN FILE CAR
FOR ALL NEXT CAR.COUNTRY INTO CARSTACK;
TYPE "<CARSTACK.FOCCOUNT  <CARSTACK(1).COUNTRY";
TYPE ON MYVAL "<<CARSTACK(1).COUNTRY";
END
-RUN
-READ MYVAL &CNTRY.A10
-TYPE &CNTRY



Alan.
WF 7.705/8.007
June 17, 2009, 01:29 PM
John_Edwards
That's about it -- seems to be the easiest way though I hadn't thought it as tight as you have it there.

I wasn't going to App Fi into an application. Will multiple users overwrite each other if I do it the way you show?

J.



June 17, 2009, 02:32 PM
j.gross
An neater alternative (IMHO) is to have the Maintain emit a temp fex containing -SET statements, and then invoke it with -INCUDE -- for example:
FILEDEF FEXFILE DISK ./FEXFILE.FEX

MAINTAIN FILE CAR
-* the calculations:
 COUNTRY="USA";
 CAR="HUMMER";
-* populate the fex:
 TYPE ON FEXFILE "-SET &|COUNTRY='" <COUNTRY "';";
 TYPE ON FEXFILE "-SET &|CAR    ='" <CAR"';";
END
-RUN

-INCLUDE ./FEXFILE.FEX

-? &C



- Jack Gross
WF through 8.1.05
June 17, 2009, 02:51 PM
Alan B
Whichever way you go, just APP FI MYFILE DISK INAGENT.TMP to use the agent folders.


Alan.
WF 7.705/8.007