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     [SOLVED] Extract IDs from a hold file for a loop

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] Extract IDs from a hold file for a loop
 Login/Join
 
Member
posted
I am working on a brief report for multiple constituents which needs to be in the following format and exported as a PDF document.

Constituent Name
Address
Contact Reports
Page Break

Next Constituent Name
Address
Contact Reports

Below is some of my code. It loops through the tables and prints each one rather matching hold files together because there are an unspecified number of contact reports that are over 4000 characters (AMRCONT table). I need to be able to print all of them just below the name and address in a PDF Format.

It works with this code, but I want to loop through a group of IDs that are in an existing hold file rather than adding each one manually with a limit on the number entered.
How can I extract one ID at a time from a hold file to loop through this process?

Thanks in advance to anyone who may have some ideas!

  

-DEFAULT &APP_ID1 = '900001111';
-DEFAULT &APP_ID2 = '900001112';
-DEFAULT &APP_ID3 = '900001113';
-SET &COUNTER1 = 0;
-START_LOOP
-SET &COUNTER1 = &COUNTER1 + 1;

-IF &COUNTER1 EQ 1 THEN GOTO 'ID_1'	ELSE IF &COUNTER1 EQ 2 GOTO 'ID_2' ELSE IF &COUNTER1 EQ 3 GOTO 'ID_3' ELSE GOTO 'PDF_CLOSE';

-ID_1
-IF &APP_ID1 NOT LIKE '9%' GOTO 'START_LOOP';
-SET &AppID = &APP_ID1;
-GOTO START_DATA

-ID_2
-IF &APP_ID2 NOT LIKE '9%' GOTO 'START_LOOP';
-SET &AppID = &APP_ID2;
-GOTO START_DATA

-ID_3
-IF &APP_ID3 NOT LIKE '9%' GOTO 'START_LOOP';
-SET &AppID = &APP_ID3;
-GOTO START_DATA

-START_DATA

TABLE FILE SPRIDEN
PRINT     
  SPRIDEN_ID  
  SPRIDEN_LAST_NAME
BY SPRIDEN_PIDM NOPRINT
WHERE ( SPRIDEN_ID EQ '&AppID' );
ON TABLE PCHOLD FORMAT PDF OPEN NOBREAK
END

JOIN
  AMRCONT.AMRCONT.AMRCONT_PIDM IN AMRCONT TO MULTIPLE
  SPRIDEN.SPRIDEN.SPRIDEN_PIDM IN SPRIDEN AS JSP1
END
TABLE FILE AMRCONT
PRINT	
AMRCONT_CALL_REPORT
BY HIGHEST AMRCONT_CONTACT_DATE 
BY AMRCONT_PIDM NOPRINT
WHERE ( SPRIDEN_ID EQ '&AppID' );
ON TABLE PCHOLD FORMAT PDF OPEN
END

-IF &COUNTER1 LT 3 THEN GOTO 'START_LOOP' ELSE GOTO 'PDF_CLOSE';

-PDF_CLOSE

TABLE FILE CA_PIDM
BY PROSPIDM NOPRINT
WHERE RECORDLIMIT EQ 1
HEADING
“.”
ON TABLE PCHOLD FORMAT PDF CLOSE
END

This message has been edited. Last edited by: Kerry,


WebFocus 7703
 
Posts: 27 | Registered: April 04, 2012Report This Post
Virtuoso
posted Hide Post
See an example using the CAR file:
-* File cdela01.fex
TABLE FILE CAR
PRINT MODEL
ON TABLE SAVE
END
-RUN
-SET &LL=&LINES;
-REPEAT #PDF FOR &I FROM 1 TO ≪
-READ SAVE, &MODEL
-SET &PDFTYPE=IF &I EQ 1 THEN 'OPEN NOBREAK' ELSE IF &I EQ &LL THEN 'CLOSE' ELSE 'NOBREAK';
TABLE FILE CAR
PRINT SALES RCOST DCOST
BY BODYTYPE
WHERE MODEL EQ '&MODEL';
HEADING
"MODEL: &MODEL"
ON TABLE PCHOLD FORMAT PDF &PDFTYPE
END
-#PDF


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

 
Posts: 1980 | Location: Tel Aviv, Israel | Registered: March 23, 2006Report This Post
Member
posted Hide Post
Thank you. That worked great for going through one table file. However, I am running into some issues when I try to use that same variable for two table files. See the code below. If I attempt the second table in there, it gets stuck on the first variable of the loop and prints the same record over and over. Any suggestions? Thank you!

  
TABLE FILE CA_TEST
PRINT SPRIDEN_PIDM
ON TABLE SAVE
END

-RUN
-SET &LL=&LINES;
-REPEAT #PDF FOR &I FROM 1 TO ≪
-READ SAVE, &PPIDM



-SET &1PDFTYPE=IF &I EQ 1 THEN 'OPEN'  ELSE 'NOBREAK';
-SET &PDFTYPE=IF &I EQ &LL THEN 'CLOSE' ELSE 'NOBREAK';


TABLE FILE APBCONS
PRINT APBCONS_PREF_CLAS
BY APBCONS_PIDM
WHERE APBCONS_PIDM EQ &PPIDM;
ON TABLE PCHOLD FORMAT PDF &1PDFTYPE
END


TABLE FILE SPRIDEN
PRINT
     SPRIDEN_ID
BY SPRIDEN_PIDM
WHERE SPRIDEN_PIDM EQ &PPIDM;
WHERE ( SPRIDEN_CHANGE_IND EQ MISSING );
WHERE ( SPRIDEN_ENTITY_IND EQ 'P' );
ON TABLE PCHOLD FORMAT PDF &PDFTYPE
END
-RUN

-#PDF
-EXIT


WebFocus 7703
 
Posts: 27 | Registered: April 04, 2012Report This Post
Virtuoso
posted Hide Post
-RUN normally closes any open files, with the result that all the -READ's in the loop will start from the top.

Either move the -RUN out of the loop, or include the NOCLOSE option on the -READ:


Syntax: How to Retrieve a Variable Value From an External File
-READ filename[,] [NOCLOSE] &name[.format.][,][&name][.format.]



-Jack Gross
 
Posts: 1925 | Location: NYC | In FOCUS since 1983 | Registered: January 11, 2005Report This Post
Member
posted Hide Post
Thank you! That resolved the issue. It works perfectly now!


WebFocus 7703
 
Posts: 27 | Registered: April 04, 2012Report 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     [SOLVED] Extract IDs from a hold file for a loop

Copyright © 1996-2020 Information Builders