As of December 1, 2020, Focal Point is retired and repurposed as a reference repository. We value the wealth of knowledge that's been shared here over the years. You'll continue to have access to this treasure trove of knowledge, for search purposes only.
Join the TIBCO Community TIBCO Community is a collaborative space for users to share knowledge and support one another in making the best use of TIBCO products and services. There are several TIBCO WebFOCUS resources in the community.
From the Home page, select Predict: WebFOCUS to view articles, questions, and trending articles.
Select Products from the top navigation bar, scroll, and then select the TIBCO WebFOCUS product page to view product overview, articles, and discussions.
Request access to the private WebFOCUS User Group (login required) to network with fellow members.
Former myibi community members should have received an email on 8/3/22 to activate their user accounts to join the community. Check your Spam folder for the email. Please get in touch with us at community@tibco.com for further assistance. Reference the community FAQ to learn more about the community.
I have 2 queries and based on the number of rows in the 1st query, the 2nd query has to loop those many times.
Say in the 1st query if I have 6 rows, then my 2nd query has to loop 6 times. Next time if the 1st query has 10 rows,then my 2nd query has to loop 10 times.
Iam new to this one and any help on how to do this would be highly appreciated!
Thanks a lot in advance!
Regards, IPThis message has been edited. Last edited by: Tamra,
If you only need to loop n times, the number of rows in the first query is in the &LINES variable.
Something like:
TABLE FILE CAR
SUM FST.COUNTRY
BY COUNTRY
END
-RUN
-REPEAT :LABEL FOR &I FROM 1 TO &LINES;
TABLE FILE CAR
SUM FST.CAR
END
-:LABEL
My guess is that you want to do something for each row in the first table though, in which case you're probably better served by a JOIN or a WHERE IN FILE.
WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010 : Member of User Group Benelux :
Thanks Dave and Wep5622 for the response and for the examples.
Actually I have 2 queries: The 1st one would be like this : select * from table1 ; TABLE FILE table1 print id text noprint on table hold as hld1 end -run
Output : The result of the above query will be something like this :[Say it gives me 5 rows this time and next time if the data is more,then it would yield me 10 rows and so on] 100 200 300 400 500
This is my second query : Select * from table2 where table2.text2 = text and table2.id2 in (id); end
Table file sqlout print * end
Now in the 2nd query, in the where condition, while Iam checking out for the id[where id2 in id] and this has to looped 5 times since we have got 5 rows in the 1st query.
Any thoughts/ideas on how to do this is greatly appreciated! Thanks a lot in advance!
TABLE FILE CAR
PRINT COUNTRY CAR MODEL
ON TABLE HOLD AS TEST
END
-RUN
TABLE FILE SYSCOLUM
PRINT NAME
WHERE TBNAME EQ 'TEST'
ON TABLE SAVE
END
-SET &howmany = &LINES;
TABLE FILE CAR
PRINT
-REPEAT :LP &howmany TIMES
-READ SAVE NOCLOSE &A.20
-TYPE &A
-SET &FIELDS=DECODE &A('COUNTRY' 'COUNTRY AS ''The Country''' 'CAR' 'CAR AS ''The Car''' 'MODEL' 'MODEL AS ''The Model''');
&FIELDS.EVAL
-:LP
END
Its all about -READ & -REPEAT. All the best! It may help
-Rifaz
WebFOCUS 7.7.x and 8.x
Posts: 406 | Location: India | Registered: June 13, 2013