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     How to pass values to a called procedure

Read-Only Read-Only Topic
Go
Search
Notify
Tools
How to pass values to a called procedure
 Login/Join
 
<new2focus>
posted
I am trying to create a compound report on pdf (all on one page, if possible) by calling one/more proc inside a loop from the first procedure. But Its doesn�t display the report.
What am I missing or doing incorrect? Also how can I pass the value of country to test_02.fex
from test_01.fex inside the loop.
Thanks for your time.

-* File test_01.fex
TABLE FILE CAR
BY COUNTRY
ON TABLE HOLD AS CTRYHLD FORMAT ALPHA
END
-RUN
-*--------------------------------------------------------
-* Read the list of countries:
-*--------------------------------------------------------
-SET &CTRYLIST = '';
-SET &CNTRY_COUNT = &LINES;
-REPEAT :CTRYLOOP FOR &CNT FROM 1 TO &CNTRY_COUNT;
-READ CTRYHLD &TMPVAR.A10 NOCLOSE
-SET &CTRYLIST.&CNT = &TMPVAR;
-:CTRYLOOP
END
-*---------------------------------------------------------
-* Execute another procedure passing the value of country
-*---------------------------------------------------------
SET PAGE-NUM=NOPAGE
SET PRINTPLUS=ON
SET COMPOUND=OPEN

-REPEAT SALES_LOOP FOR &CNT FROM 1 TO &CNTRY_COUNT;
-TYPE &CTRYLIST.&CNT
-* How can I pass the value of country to test_02.fex?
EX test_02.fex
-SALES_LOOP

SET COMPOUND=CLOSE
END

-* File test_02.fex
-DEFAULT &COUNTRY='ENGLAND';
TABLE FILE CAR
SUM
SALES
DEALER_COST
BY
COUNTRY
WHERE (COUNTRY EQ '&COUNTRY')
ON TABLE SET PAGE-NUM OFF
ON TABLE NOTOTAL
ON TABLE PCHOLD FORMAT PDF NOBREAK
ON TABLE SET STYLE *
UNITS=IN, PAGESIZE='A4', SQUEEZE=OFF, ORIENTATION=LANDSCAPE, $
TYPE=REPORT, GRID=ON, $
END
 
Report This Post
Virtuoso
posted Hide Post
-REPEAT SALES_LOOP FOR &CNT FROM 1 TO &CNTRY_COUNT;
-TYPE &CTRYLIST.&CNT
-* How can I pass the value of country to test_02.fex?
EX test_02 COUNTRY='&CNTRYLIST.&CNT'
-SALES_LOOP
 
Posts: 1102 | Location: Toronto, Ontario | Registered: May 26, 2004Report This Post
<new2focus>
posted
Thanks for your reply.

As you suggested I have changed the first proc as
-*EX test_02.fex
EX test_02 COUNTRY='&CTRYLIST.&CNT'

But it displays an html page with the following.
0 NUMBER OF RECORDS IN TABLE= 5 LINES= 5
ENGLAND
FRANCE
ITALY
JAPAN
W GERMANY
0 NUMBER OF RECORDS IN TABLE= 4 LINES= 1
0 NUMBER OF RECORDS IN TABLE= 1 LINES= 1
0 NUMBER OF RECORDS IN TABLE= 4 LINES= 1
0 NUMBER OF RECORDS IN TABLE= 2 LINES= 1
0 NUMBER OF RECORDS IN TABLE= 7 LINES= 1
 
Report This Post
<JG>
posted
In a compound report your last PCHOLD FORMAT PDF

MUST use PCHOLD FORMAT PDF CLOSE
 
Report This Post
Platinum Member
posted Hide Post
I apologize for disputing you, JG, but that statement is not true. However, the SET COMPOUND=CLOSE does have to come prior to the final TABLE FILE, not after. Your loop needs to be smart enough to know that you are about to execute the report program for the last time. Or you need to make that last execution outside the loop.
 
Posts: 135 | Location: Portland, OR | Registered: March 23, 2005Report This Post
<new2focus>
posted
I have modified the procs as follows. But I am still not getting the pdf report? What am I missing?

-* File test_01.fex
SET TRACEON = ALL
SET TRACEUSER = ON

TABLE FILE CAR
BY COUNTRY
ON TABLE HOLD AS CTRYHLD FORMAT ALPHA
END
-RUN
-*--------------------------------------------------------
-* Read the list of countries:
-*--------------------------------------------------------
-SET &CTRYLIST = '';
-SET &CNTRY_COUNT = &LINES;
-REPEAT :CTRYLOOP FOR &CNT FROM 1 TO &CNTRY_COUNT;
-READ CTRYHLD &TMPVAR.A10 NOCLOSE
-SET &CTRYLIST.&CNT = &TMPVAR;
-:CTRYLOOP
END
-*-------------------------------------------------------
-* Call the second procedure passing the value of country
-*-------------------------------------------------------
SET PAGE-NUM=NOPAGE
SET PRINTPLUS=ON
SET COMPOUND=OPEN

-SET &COUNT=0;
-REPEAT SALES_LOOP FOR &CNT FROM 1 TO &CNTRY_COUNT;
-SET &COUNT=&COUNT + 1;
-TYPE TEST_01:Country =&CTRYLIST.&CNT
-SET &PAGETYPE=IF &COUNT EQ &CNTRY_COUNT THEN 'Y' ELSE (IF &COUNT EQ 1 THEN 'F' ELSE 'L');
-TYPE TEST_01:PageType=&PAGETYPE
EX test_02 COUNTRY='&CTRYLIST.&CNT', PAGETYPE='&PAGETYPE'
-SALES_LOOP
SET COMPOUND=CLOSE
END


-* File test_02.fex
-DEFAULT &COUNTRY='ENGLAND';
-DEFAULT &PAGETYPE='Y';
TABLE FILE CAR
SUM
SALES
DEALER_COST
BY
COUNTRY
WHERE (COUNTRY EQ '&COUNTRY')
ON TABLE SET PAGE-NUM OFF
ON TABLE NOTOTAL

-TYPE TEST_02:Country =&COUNTRY
-TYPE TEST_02:PageType=&PAGETYPE

-IF '&PAGETYPE' EQ 'L' GOTO CLOSEPDF ELSE (IF '&PAGETYPE' EQ 'F' GOTO OPENPDF);
ON TABLE PCHOLD FORMAT PDF
-GOTO PDFEND

-OPENPDF
ON TABLE PCHOLD FORMAT PDF OPEN
-GOTO PDFEND

-CLOSEPDF
ON TABLE PCHOLD FORMAT PDF CLOSE
-PDFEND

ON TABLE SET STYLE *
UNITS=IN, PAGESIZE='A4', SQUEEZE=OFF, ORIENTATION=LANDSCAPE, $
TYPE=REPORT, GRID=ON, $
END
 
Report This Post
<new2focus>
posted
Could anyone please provide me with a sample code to create this report?
 
Report This Post
Virtuoso
posted Hide Post
Couple of things are wrong.

Change origional to this:
-SET &PAGETYPE=IF &COUNT EQ &CNTRY_COUNT THEN 'L' ELSE (IF &COUNT EQ 1 THEN 'F' ELSE 'N');
-TYPE TEST_01:PageType=&PAGETYPE
-SET &COUNTRY=&CTRYLIST.&CNT;
-INCLUDE test_02
-SALES_LOOP

then test_02 to this:
-IF &PAGETYPE EQ 'L' GOTO CLOSEPDF ELSE
-IF &PAGETYPE EQ 'F' GOTO OPENPDF;

That should work for ya!
 
Posts: 1102 | Location: Toronto, Ontario | Registered: May 26, 2004Report This Post
Virtuoso
posted Hide Post
For future reference, this might be a little easier to debug (I don't like GOTO's):

-* File test_01.fex

TABLE FILE CAR
BY COUNTRY
ON TABLE HOLD AS CTRYHLD FORMAT ALPHA
END
-RUN

-*--------------------------------------------------------
-* Read the list of countries:
-*--------------------------------------------------------

-SET &CNTRY_COUNT = &LINES;
-REPEAT :CTRYLOOP FOR &CNT FROM 1 TO &CNTRY_COUNT;
-READ CTRYHLD &TMPVAR.A10. NOCLOSE
-SET &CTRYLIST.&CNT = &TMPVAR;
-:CTRYLOOP
-CLOSE CTRYHLD

-*-------------------------------------------------------
-* Call the second procedure passing the value of country
-*-------------------------------------------------------
SET PAGE-NUM=NOPAGE
SET PRINTPLUS=ON
SET COMPOUND=OPEN

-REPEAT SALES_LOOP FOR &CNT FROM 1 TO &CNTRY_COUNT;
-SET &OPEN_CLOSE = IF &CNT EQ &CNTRY_COUNT THEN 'CLOSE' ELSE
- IF &CNT EQ 1 THEN 'OPEN' ELSE ' ';
-SET &COUNTRY=&CTRYLIST.&CNT;
-INCLUDE test_02
-SALES_LOOP

SET COMPOUND=CLOSE


-* File test_02.fex
-DEFAULT &COUNTRY='ENGLAND'
-DEFAULT &OPEN_CLOSE=' '

TABLE FILE CAR
SUM
SALES
DEALER_COST
BY
COUNTRY
WHERE (COUNTRY EQ '&COUNTRY')
ON TABLE SET PAGE-NUM OFF
ON TABLE NOTOTAL
ON TABLE PCHOLD FORMAT PDF &OPEN_CLOSE
ON TABLE SET STYLE *
UNITS=IN, PAGESIZE='A4', SQUEEZE=OFF, ORIENTATION=LANDSCAPE, $
TYPE=REPORT, GRID=ON, $
ENDSTYLE
END
 
Posts: 1102 | Location: Toronto, Ontario | Registered: May 26, 2004Report This Post
<new2focus>
posted
Thanks dhagen! Its is working now.
Is there anyway I can display all in one page or without the page breaks for each country?. Its displaying one page per country now.
 
Report This Post
Virtuoso
posted Hide Post
-SET &OPEN_CLOSE = IF &CNT EQ &CNTRY_COUNT THEN 'CLOSE' ELSE
- IF &CNT EQ 1 THEN 'OPEN NOBREAK' ELSE 'NOBREAK';

What I mean is use NOBREAK for all non PDF CLOSE's
 
Posts: 1102 | Location: Toronto, Ontario | Registered: May 26, 2004Report This Post
<new2focus>
posted
You are right dhagen, GOTO is a pain. When I try to run your test_01.fex (test_02.fex is running fine seperately) it says

0 NUMBER OF RECORDS IN TABLE= 5 LINES= 5
0 ERROR AT OR NEAR LINE 54 IN PROCEDURE ADHOCRQ FOCEXEC *
(FOC260) AN OPERATION IS MISSING AN ARGUMENT

How do I find the line 54? Test_01.fex has only 36 lines and test_02.fex has got 19 lines. Could you please suggest me some debugging techniques?
 
Report This Post
Virtuoso
posted Hide Post
new2focus I sent you a pm with my number, call me and we'll try to finish this up.

However, one thing I would do is put the following 2 lines at the top of test_02.fex.

-SET &ECHO=ON;
-SET &STACK=OFF;

The &ECHO will display the resolved focus code, while the &STACK will tell WebFOCUS not to execute the focus code. This way, you can see the final focus code that will be executed, and eyeball it for errors.
 
Posts: 1102 | Location: Toronto, Ontario | Registered: May 26, 2004Report This Post
<new2focus>
posted
When I changed the IF statement to the following (made it all on same line), then its displaying all the reports on the same page. It seems like Webfocus somehow didn�t like the IF on the next line.

-SET &OPEN_CLOSE = IF &CNT EQ &CNTRY_COUNT THEN 'CLOSE'
ELSE IF &CNT EQ 1 THEN 'OPEN NOBREAK'
ELSE 'NOBREAK';

Thanks a lot for your help dhagen. I truly appreciate your time. I am slowly making my way onto my ultimate challenge in Webfocus reporting. ( https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/
7321058331/r/7321058331
). It would be great if you could shed any ideas on how to generate this report. Once again thanks a lot for you help and time on this post. I learnt many new things today.

This message has been edited. Last edited by: Kerry,
 
Report 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     How to pass values to a called procedure

Copyright © 1996-2020 Information Builders