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] Using -IF...THEN GOTO...ELSE GOTO on Compound reports

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] Using -IF...THEN GOTO...ELSE GOTO on Compound reports
 Login/Join
 
Member
posted
Hello, I am a WebFOCUS newbie trying to get up to speed quickly. Thanks in advance for any help or assistance anyone can provide.

I am writing a compound report (one that outputs to multiple excel tabs) that also utilizes if/then/else statements to control the content of the tabs. My report looks like this:

-DEFAULT &Var1 = 0;
-DEFAULT &Var2 = 0;
-SET &Var1=IF &Var1 EQ 0 THEN 'FOC_NONE' ELSE &Var1;
-SET &Var2=IF &Var2 EQ 0 THEN 'FOC_NONE' ELSE &Var2;

Report Contents

;
ON TABLE SET PAGE-NUM OFF
ON TABLE NOTOTAL
ON TABLE PCHOLD FORMAT EXL2K OPEN
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
UNITS=IN,
SQUEEZE=ON,
ORIENTATION=PORTRAIT,
$
TYPE=REPORT,
TITLETEXT='Excel Tab 1',
GRID=OFF,
FONT='TIMES NEW ROMAN',
SIZE=10,
$
TYPE=TITLE,
COLOR='WHITE',
BACKCOLOR=RGB(96 131 159),
STYLE=BOLD,
$
TYPE=REPORT,
COLUMN=N8,
SQUEEZE=OFF,
$
ENDSTYLE

-IF &LINES EQ 0 THEN GOTO BLANKER ELSE GOTO JUMPBLANKER;

-BLANKER
DEFINE FILE output_from_report1
NOREC/A60='No records found that match your parameters.';
END
TABLE FILE output_from_report1
PRINT NOREC AS ''
BY column1 NOPRINT
WHERE RECORDLIMIT EQ 1
ON TABLE SET PAGE-NUM OFF
ON TABLE NOTOTAL
ON TABLE PCHOLD FORMAT EXL2K OPEN
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
UNITS=IN,
ORIENTATION=PORTRAIT,
TITLETEXT='Excel Tab 1',
$
TYPE=REPORT,
SQUEEZE=OFF,
STYLE=BOLD,
WRAP=0,

$
ENDSTYLE

-JUMPBLANKER
-*=========================Next tab=======================================
-RUN
Report Contents

;
ON TABLE SET HTMLENCODE ON
ON TABLE NOTOTAL
ON TABLE PCHOLD FORMAT EXL2K CLOSE
ON TABLE SET STYLE *
TITLETEXT='Excel Tab 2',

$
UNITS=IN,
PAGESIZE='Letter',
LEFTMARGIN=0.500000,
RIGHTMARGIN=0.500000,
TOPMARGIN=0.500000,
BOTTOMMARGIN=0.500000,
SQUEEZE=ON,
ORIENTATION=PORTRAIT,
$
TYPE=REPORT,
GRID=OFF,
FONT='GARAMOND',
SIZE=10,
RIGHTGAP=0.125000,
TOPGAP=0.013889,
BOTTOMGAP=0.027778,
JUSTIFY=CENTER,
$
ENDSTYLE


-IF &LINES EQ 0 THEN GOTO BLANKER2 ELSE GOTO JUMPBLANKER2;

-BLANKER2
DEFINE FILE output_from_report2
NOREC1/A60='No records found that match your parameters 2.';
END
TABLE FILE output_from_report2
PRINT NOREC1 AS ''
BY column1 NOPRINT
WHERE RECORDLIMIT EQ 1
ON TABLE SET HTMLENCODE ON
ON TABLE NOTOTAL
ON TABLE PCHOLD FORMAT EXL2K CLOSE
ON TABLE SET STYLE *
TITLETEXT='Excel Tab 2',
$
TYPE=REPORT,
GRID=OFF,
STYLE=BOLD,
WRAP=0,

$
ENDSTYLE
END
-JUMPBLANKER2
END

If the second report has no lines, I cannot get Excel Tab 2 to generate with my message. The first tab always generates correctly no matter what, and both tabs generate correctly if they both have lines.

I think the problem is the ON TABLE PCHOLD FORMAT EXL2K CLOSE statement after the second report is finished (before we get to BLANKER2). If I delete CLOSE, then the reports generate correctly when second report has no lines. However, without CLOSE there, when the second report DOES have lines, the entire compound report just gives me a "Your request did not return any output to display" message.

Any help would be greatly appreciated, thanks!

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


intsoccersuperstar
WebFOCUS 8105m
Windows, Excel
 
Posts: 16 | Registered: October 17, 2018Report This Post
Virtuoso
posted Hide Post
Two things that I can see

1- You need the key word END after each ENDSTYLE. The END tells Focus that the TABLE FILE ... is completed. Put it at each place to have a better reading.
2- You already have closed your Excel file if no data is found for tab 2 before going to BLANKER2

To solve situation -2- what I would do is to first extract your report data and hold it. Then if you have data then generate the Excel tab with the data otherwise go to the "empty" tab

something such as this

TABLE FILE FILE1
....
ON TABLE HOLD AS DATATAB1
END
-RUN

-IF &LINES GT 0 GOTO TAB1 ELSE GOTO EMPTYTAB1;

-TAB1
TABLE FILE DATATAB1
...
ON TABLE SET PAGE-NUM OFF
ON TABLE NOTOTAL
ON TABLE PCHOLD FORMAT EXL2K OPEN
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
 UNITS=IN,
 SQUEEZE=ON,
 ORIENTATION=PORTRAIT,
$
TYPE=REPORT,
	TITLETEXT='Excel Tab 1',
 GRID=OFF,
 FONT='TIMES NEW ROMAN',
 SIZE=10,
$
TYPE=TITLE,
 COLOR='WHITE',
 BACKCOLOR=RGB(96 131 159),
 STYLE=BOLD,
$
TYPE=REPORT,
 COLUMN=N8,
 SQUEEZE=OFF,
$
ENDSTYLE
END
-RUN
-GOTO EXTTAB2

-EMPTYTAB1
DEFINE FILE output_from_report1
NOREC/A60='No records found that match your parameters.';
END
TABLE FILE output_from_report1
PRINT NOREC AS ''
BY column1 NOPRINT
WHERE RECORDLIMIT EQ 1
ON TABLE SET PAGE-NUM OFF
ON TABLE NOTOTAL
ON TABLE PCHOLD FORMAT EXL2K OPEN
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
	UNITS=IN,
	ORIENTATION=PORTRAIT,
	TITLETEXT='Excel Tab 1',
$
TYPE=REPORT,
SQUEEZE=OFF,
STYLE=BOLD,
WRAP=0,

$
ENDSTYLE
END
-RUN
-GOTO EXTTAB2

-EXTTAB2
TABLE FILE FILE2
...
ON TABLE HOLD AS DATATAB2
END
-RUN

-IF &LINES GT 0 GOTO TAB2 ELSE GOTO EMPTYTAB2;

-TAB2
TABLE FILE DATATAB2
...
ON TABLE SET HTMLENCODE ON
ON TABLE NOTOTAL
ON TABLE PCHOLD FORMAT EXL2K CLOSE
ON TABLE SET STYLE *
TITLETEXT='Excel Tab 2',

$
 UNITS=IN,
 PAGESIZE='Letter',
 LEFTMARGIN=0.500000,
 RIGHTMARGIN=0.500000,
 TOPMARGIN=0.500000,
 BOTTOMMARGIN=0.500000,
 SQUEEZE=ON,
 ORIENTATION=PORTRAIT,
$
TYPE=REPORT,
 GRID=OFF,
 FONT='GARAMOND',
 SIZE=10,
 RIGHTGAP=0.125000,
 TOPGAP=0.013889,
 BOTTOMGAP=0.027778,
 JUSTIFY=CENTER,
$
ENDSTYLE
END
-RUN
-EXIT

-EMPTYTAB2
DEFINE FILE output_from_report2
NOREC1/A60='No records found that match your parameters 2.';
END
TABLE FILE output_from_report2
PRINT NOREC1 AS ''
BY column1 NOPRINT
WHERE RECORDLIMIT EQ 1
ON TABLE SET HTMLENCODE ON
ON TABLE NOTOTAL
ON TABLE PCHOLD FORMAT EXL2K CLOSE
ON TABLE SET STYLE *
	TITLETEXT='Excel Tab 2',
$
TYPE=REPORT,
GRID=OFF,
STYLE=BOLD,
WRAP=0,

$
ENDSTYLE
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
 
Posts: 2409 | Location: Montreal Area, Qc, CA | Registered: September 25, 2013Report This Post
Member
posted Hide Post
That works, thank you. I think I had an incomplete understanding of what TABLE HOLD can do. As you may have guessed, this is an existing report that I am "improving". Basically combining two reports into one so the business process down the line doesn't have to run multiple reports to get something that they just combine into a single Excel file anyway.


intsoccersuperstar
WebFOCUS 8105m
Windows, Excel
 
Posts: 16 | Registered: October 17, 2018Report This Post
Expert
posted Hide Post
Also note the use of the -run statement used before any of the dialogue manager commands: -GOTO or -IF.




   In FOCUS Since 1983 ~ from FOCUS to WebFOCUS.
   Current: WebFOCUS Administrator at FIS Worldpay | 8204, 8206
 
Posts: 3132 | Location: Tennessee, Nashville area | Registered: February 23, 2005Report 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] Using -IF...THEN GOTO...ELSE GOTO on Compound reports

Copyright © 1996-2020 Information Builders