Focal Point
[SOLVED] SQL runs not once

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

November 08, 2013, 08:18 AM
Piter
[SOLVED] SQL runs not once
Hi,

I am doing


ENGINE SQLODBC SET DEFAULT_CONNECTION kuku

SQL SQLODBC PREPARE HO FOR
select ....
END
-RUN

and after that several time doing things like
DEFINE HO
dd/a3= ....
END
TABLE FILE HO
PRINT *
WHERE XX EQ 1
END

DEFINE HO
dd/a3= ....
END
TABLE FILE HO
PRINT *
WHERE XX EQ 6
END

etc.

When I look on log, it is showing me that WF runs select that I wrote to extract file HO each time when I do TABLE FILE HO. Each time this select goes with additional consitionsl like XX=1 or XX=6 etc.

Is it normal?
Do I need to do imidiately after SQL extract something like
TABLE FILE HO
PRINT *
ON TABLE HOLD AS HO2
END

and then use HO2 doing all necessary transformations?

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


Wf7704/WF8,Win64/32
November 08, 2013, 08:27 AM
Tim P.
A SQL passthru will run everytime you run that fex file. I think what you are trying to accomplish is to create a permanent hold file where you take your SQL passthru, run it and then save the subsequent table so you can use it in other fexes, such as...
ENGINE SQLORA SET DEFAULT_CONNECTION <databasename>
SQL SQLORA PREPARE SQLOUT FOR
SELECT 
<whatever your SQL code is>
END

APP HOLD <name of folder on app server where you want to store the table>

TABLEF FILE SQLOUT
PRINT
<WF code here, this will be the structure and fields of the table you save>
END


APP HOLD


Hopefully this helps


WebFOCUS App Studio 8.2.02
Windows 7, All Outputs
November 08, 2013, 08:33 AM
MattC
Another way to do this is to:

SQL
SELECT ........
FROM ......
WHERE .....
;
TABLE
ON TABLE HOLD AS ...... FORMAT ......
END
-RUN


Then do your defines. Your SQL will only run once.


WebFOCUS 8.1.05
November 08, 2013, 08:44 AM
Piter
Thanks, Toma and MattC!


Wf7704/WF8,Win64/32