Focal Point
[SOLVED] Calling a procedure for each record in TABLE FILE

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

June 25, 2013, 12:11 AM
JC Zhu
[SOLVED] Calling a procedure for each record in TABLE FILE
I have a reusable procedure that I want to call from a master procedure. The master procedure has a TABLE FILE command. I want to call the reusable procedure for each record in the table in the master procedure and pass values in the current record as parameters to the reusable procedure. Is that possible?

This message has been edited. Last edited by: <Kathryn Henning>,


WebFOCUS 7.7.3
Windows, All Outputs
June 25, 2013, 12:24 AM
Waz
Yes, but I am not aware of any default functionality to do this (unless the process can be done in a define function).

You will need to hold the records, then use Dialog Manager to read the record as amper variable that can then be picked up by the sub procedure.

without knowing what your process actually its difficult to suggest much more.


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

June 25, 2013, 08:27 AM
Alex
Once you hold your file from the master procedure you can establish a loop to read each value or set of values into parameters, do whatever you are going to do with them and return to repeat the loop until you get through all of the held records.


WF 7.7.04, WF 8.0.7, Win7, Win8, Linux, UNIX, Excel, PDF
June 25, 2013, 12:09 PM
JC Zhu
Thank you both for your answers. I was hoping that I would be able to do it directly inside a TABLE FILE or DEFINE FILE, via calling a function or something like that. It sounds like that's not possible.


WebFOCUS 7.7.3
Windows, All Outputs
June 25, 2013, 01:31 PM
j.gross
It can be done without resorting to a dialog manager loop. Something like this:
FILEDEF DRIVER DISK driver.fex
DEFINF FILE HOLD
  CMD/A1000 = . . . ;
END
TABLE FILE HOLD
  PRINT CMD
  ON TABLE SAVE AS DRIVER
END
-RUN
-INCLUDE driver.fex

CMD would contain the EX command, to call the fex and pass the arguments. It would be defined be a catenation of
'EX fexname '
'parmname='
character representation of value
','
. . .
June 25, 2013, 05:39 PM
Waz
How complex is the reusable procedure ?

What is it doing ?

Could you enhance that procedure to accept a hold file and process it, so the loop is self contained.


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

June 26, 2013, 01:15 AM
Danny-SRL
JC,

What do you call a "reusable procedure"?
In what language is it written? 3G? FOCUS?
And what does the reusable procedure do?


Daniel
In Focus since 1982
wf 8.202M/Win10/IIS/SSA - WrapApp Front End for WF

July 17, 2013, 05:23 PM
JC Zhu
Sorry for not following up on this post after such a long time. The solution suggested by j-gross works for me. Thank you all for your inputs.


WebFOCUS 7.7.3
Windows, All Outputs