TABLE FILE myTable
PRINT VAR1 VAR2 VAR3
-* Assuming that myTable only has one record, no need to perform a filter (WHERE) otherwise multiple lines will be returned
WHERE myTable.myFld EQ cond;
ON TABLE HOLD AS TMP
END
-RUN
-READFILE TMP
-RUN
-* TO AVOID VARIABLE'S PROMPTING
-DEFAULTH &VAR1 = ''
-DEFAULTH &VAR2 = ''
-DEFAULTH &VAR3 = ''
TABLE FILE oTable
PRINT ABC
BY XYZ
WHERE oTable.tstFld1 EQ &VAR1;
WHERE oTable.tstFld2 EQ &VAR2;
WHERE oTable.tstFld3 EQ &VAR3;
END
-RUN
WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF In Focus since 2007
September 30, 2019, 12:02 PM
FP Mod Chuck
Kykyn
First of all welcome to Focal Point. It is a great place to get answers to your development questions.
If you want these variables to be available to other reports run in the same user session then you will need to use global variarbles with 2 &&'s
-SET &&VAR1 = 'COUNTRY'
Thank you for using Focal Point!
Chuck Wolff - Focal Point Moderator WebFOCUS 7x and 8x, Windows, Linux All output Formats
October 01, 2019, 02:32 AM
Kykyn
HI,
Thanks a lot for your answers. But, unfortunately, i think i didnt have explained correctly my problem :-)
So, to begin i have a table in which one i count the number of lines :
TABLE FILE STEP1 SUM CNT.MYVAR END
I would like to keep the value of my count in a dialogue manager variable, in order to use it later in my code. For example, we say there is 10 lines in my table STEP1 I need this value to make a loop on an other table. As there is 10 lines in STEP1, i need to do a 10 times loop...
I hope this time my explanations are clear :-)
Thks Ced
WebFocus 8.2, Windows
October 01, 2019, 04:34 AM
Kykyn
Finally, after having looking it for a while in the forum, i found what i wanted!!
So, Unfortunately, my last answer make me to come back with an other question...
In the beginning of my code i have kept then number of distinct variable (nb of towns)
TABLE FILE TOWNS SUM CNT.DST.TOWNS ON TABLE SAVE END -RUN -READ SAVE &CNT_TOWNS.I9. -TYPE &CNT_TOWNS
==> i have 5 towns so the value of &CNT_TOWS is 5
And now, i work with another table, which contains the name of roads. theres are 10 lines in this table with 10 distinct values.
For each of these 10 distinct values, i would having on my final table, 5 lines (&CNT_TOWNS) with the same value (name of road). So i will have finally 50 lines in my table.
I m sure ma ask is not very clear so this is an exemple :
==> I have only 10 lines because the data are written only at the end of the loop.
thks a lot for your help
WebFocus 8.2, Windows
October 01, 2019, 07:41 AM
MartinY
Yes, it's not clear what you are attempting to perform.
What are you trying to perform : - have each Road with their Town ? - repeat each Road's name as many time you have Town ? So, as you stated : you have 5 Towns and 10 Roads so you want 5 X 10 = 50 lines in output.
Can you just JOIN the two tables together ? If no commun field exist between the two tables, you can JOIN them using a Dummy field such as below
-*-* TMP1 includes up to 5 Countries
TABLE FILE CAR
BY TOTAL COMPUTE DUMMY /I1 = 1;
BY COUNTRY
WHERE RECORDLIMIT EQ 5;
ON TABLE HOLD AS TMP1
END
-*-* TMP2 includes up to 10 Cars
TABLE FILE CAR
BY TOTAL COMPUTE DUMMY /I1 = 1;
BY CAR
WHERE RECORDLIMIT EQ 10;
ON TABLE HOLD AS TMP2
END
-*-* Since TMP1 and TMP2 have no commun field, we use a DUMMY one to create a JOIN and produce cartesian result
JOIN DUMMY IN TMP1 TAG T1
TO ALL DUMMY IN TMP2 TAG T21 AS J1
END
TABLE FILE TMP1
BY CAR
BY COUNTRY
END
-RUN
As a note : always use the code tag when posting sample code and/or data It's the last icon on the ribbon that looks like the below
</>
WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF In Focus since 2007