Focal Point Banner


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.


Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     Loop while changing a variable each iteration

Read-Only Read-Only Topic
Go
Search
Notify
Tools
Loop while changing a variable each iteration
 Login/Join
 
Member
posted
I want to run the same code multiple times but change a variable within the code each time it is run.
I am thinking focus could read a list of variables (numbers), run the code using the first variable in the list, output the file for that variable, set the variable using the second on the list, run the code using this variable for the second iteration, output, repeat multiple times. Anyone got suggestions on the code?


WebFocus 7.6.6 Win 2K
 
Posts: 29 | Registered: June 19, 2006Report This Post
Gold member
posted Hide Post
create a array with the list of variables
EX:
Array name LST: LST1, LST2, LST3 ..LST.N
LST0 = NO. OF variables in the array.

use the -REPEAT command.

-REPEAT LSTLP01 FOR LCTR FROM 1 TO &LST0;
-SET LIST = &LST.&LCTR;

TABLE FILE CAR
PRINT
-* print fields

ON TABLE HOLD AS &LIST
END
-LSTLP01




Env Prod:WebFOCUS 7702 ,Windows xp on 64, SQL Server 2008, IRF Tool
Env 1 Local: DevStudio 7702 - MS Windows XP SP2 - Apache Tomcat 5.0.28
Output: HTML, Excel and PDF
 
Posts: 52 | Location: NJ,USA | Registered: May 26, 2004Report This Post
<JG>
posted
A simple NOCLOSE on the READ is all you need

TABLE FILE CAR
BY COUNTRY
ON TABLE HOLD AS COUNTRIES FORMAT ALPHA
END
-RUN
-SET &LOOPS=&LINES;
-REPEAT ENDREPEAT &LOOPS TIMES
-READ COUNTRIES NOCLOSE &COUNTRY.A10.
TABLE FILE CAR
PRINT MODEL
BY COUNTRY
WHERE COUNTRY EQ '&COUNTRY'
END
-ENDREPEAT
 
Report This Post
Virtuoso
posted Hide Post
Out of curiosity, what is the purpose of your report, to generate separate reports each time or a report that needs multiple selection that doesn't fit a normal from-to selection.

To those who submitted answers, thanks for the education. -read is one of the verbs I've not had a lot of education on.


Leah
 
Posts: 1317 | Location: Council Bluffs, IA | Registered: May 24, 2004Report This Post
Member
posted Hide Post
Thanks for all the replies. I will try these today.
My hope it to generate a report on each iteration (generate seperate reports each time).
In a nutshell I want to run the same code, only replacing the doctor number (&DOCNUM) on each iteration. So the outputs would be a report for each doctor number that I have on a list.


WebFocus 7.6.6 Win 2K
 
Posts: 29 | Registered: June 19, 2006Report This Post
Member
posted Hide Post
JG,
Thanks for the help! This works great.
The only problem I am running into now is that the file name is the same. So it does not output a different excel file for each iteration. It only outputs one at the end that is using the last PCDOCNUM.
I am able to get it to stack all the information in HTML format but unable to get it to ouput a seperate excel file (with different names) for each PCDOCNUM. Any suggestions?


WebFocus 7.6.6 Win 2K
 
Posts: 29 | Registered: June 19, 2006Report This Post
Platinum Member
posted Hide Post
Try this. It should create three different spreadsheets with country being a part of the name.

TABLE FILE CAR
BY COUNTRY
WHERE COUNTRY IN ('ENGLAND', 'FRANCE', 'JAPAN')
ON TABLE HOLD AS COUNTRIES FORMAT ALPHA
END
-RUN
-*
-SET &LOOPS=&LINES;
-SET &P_COUNTRY=' ';
-*
-REPEAT ENDREPEAT &LOOPS TIMES
-READ COUNTRIES NOCLOSE &P_COUNTRY
-SET &NEW_FILE = 'CAR_FILE_' || &P_COUNTRY || '.XLS';
FILEDEF NEWFILE DISK &NEW_FILE
TABLE FILE CAR
PRINT MODEL
BY COUNTRY
WHERE COUNTRY EQ '&P_COUNTRY'
ON TABLE HOLD AS NEWFILE FORMAT EXL2K
END
-ENDREPEAT

Jim


WF DevStu 5.2.6/WF Srv 5.2.4/Win NT 5.2
 
Posts: 118 | Location: Lincoln Nebraska | Registered: May 04, 2005Report This Post
Member
posted Hide Post
Thank you Jim!! Worked exactly as needed.


WebFocus 7.6.6 Win 2K
 
Posts: 29 | Registered: June 19, 2006Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     Loop while changing a variable each iteration

Copyright © 1996-2020 Information Builders