I have a simple fex that prints a report. The report prints fine so long as there is data…a nicely formatted report appears. If no data, you instead see the Webfocus code showing no data was found…a little nasty looking.
So… If there is no data, I'd like to pop up a message in the footing that simply says 'No Data to Graph' To do this I put an IF STATEMENT in place, that, based on if lines are present, attempts to alter what prints in the footing.
The end result of all this that if no data is present I get an error centered around the IF statement. If data is present, I get my report, sans the footing altogether but all report formatting is lost.
Here is the code structure . . . WHERE J0.TBLMSTR_BANBRBANAMEXREF.IDXSPECIALTY EQ &IDXSPECIALTY; WHERE J0.TBLMSTR_BANBRBANAMEXREF.IDXROLLUP EQ &IDXROLLUP;
-IF &LINES NE 0 THEN GOTO PRINTRPT; FOOTING "NO DATA" -GOTO FINISHLINE
-PRINTRPT FOOTING "END OF REPORT" ON TABLE SET PAGE-NUM NOLEAD ON TABLE SUMMARIZE AS 'TOTAL' ON TABLE PCHOLD FORMAT HTML ON TABLE SET HTMLCSS ON ON TABLE SET STYLE * INCLUDE = IBFS:/EDA/EDASERVE/_EDAHOME/ETC/endeflt.sty, $ TYPE=HEADING, LINE=2, OBJECT=TEXT, ITEM=1, SIZE=10, $ TYPE=REPORT, COLUMN=N1, WRAP=6.000000, $ TYPE=REPORT, COLUMN=N2, SQUEEZE=ON, $ TYPE=REPORT, COLUMN=N3, SQUEEZE=2.555556, $ ENDSTYLE END -GOTO FINISHLINE
-FINISHLINE ENDThis message has been edited. Last edited by: RobertF,
WebFOCUS 8206.08 Windows, All Outputs
February 21, 2017, 09:14 AM
Prarie
What is the error?
February 21, 2017, 09:30 AM
RobertF
quote:
-IF &LINES NE 0 THEN GOTO PRINTRPT;FOOTING "NO DATA"-GOTO FINISHLINE
if there are lines, there is no error however my formatting /stylesheet appears to be lost and the footing does not print at all.
if there are NO LINES I get tis error:
0 NUMBER OF RECORDS IN TABLE= 0 LINES= 0 (FOC1517) UNRECOGNIZED COMMAND FOOTING (FOC1517) UNRECOGNIZED COMMAND "NO DATA"
latest code: . . . HEADING "AR Summary" "as of: &PERIOD " WHERE TBLEXTRACT_121DAYAR.TBLEXTRACT_121DAYAR.PERIOD EQ . WHERE TBLEXTRACT_121DAYAR.TBLEXTRACT_121DAYAR.RPTBANBR EQ &IDXBA2; WHERE J0.TBLMSTR_BANBRBANAMEXREF.IDXSPECIALTY EQ &IDXSPECIALTY; WHERE J0.TBLMSTR_BANBRBANAMEXREF.IDXROLLUP EQ &IDXROLLUP;
-IF &LINES NE 0 THEN GOTO PRINTRPT; FOOTING "NO DATA" -GOTO FINISHLINE
-PRINTRPT FOOTING "END OF REPORT" ON TABLE SET PAGE-NUM NOLEAD ON TABLE SUMMARIZE AS 'TOTAL' ON TABLE PCHOLD FORMAT HTML ON TABLE SET HTMLCSS ON ON TABLE SET STYLE * INCLUDE = IBFS:/EDA/EDASERVE/_EDAHOME/ETC/endeflt.sty, $ TYPE=HEADING, LINE=2, OBJECT=TEXT, ITEM=1, SIZE=10, $ TYPE=REPORT, COLUMN=N1, WRAP=6.000000, $ TYPE=REPORT, COLUMN=N2, SQUEEZE=ON, $ TYPE=REPORT, COLUMN=N3, SQUEEZE=2.555556, $ ENDSTYLE END -GOTO FINISHLINE
-FINISHLINE END
WebFOCUS 8206.08 Windows, All Outputs
February 21, 2017, 09:56 AM
Francis Mariani
The number of lines is calculated AFTER the data is retrieved and the data is retrieved AFTER the END statement which if after the -IF statement.
Unless, of course, you want to reference a previous data retrieval step for which &LINES will be valid.
-IF &LINES NE 0 THEN GOTO PRINTRPT;
Francis
Give me code, or give me retirement. In FOCUS since 1991
Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
February 21, 2017, 10:00 AM
RobertF
I see...sounds like I need to create a hold file first then report off that....
WebFOCUS 8206.08 Windows, All Outputs
February 21, 2017, 10:18 AM
MAdams1
RobertF we have developed a norecords.fex. We add one line of code to the end of all of our reports so if there is an error or no data the user will get a nicely formatted message with instructions. You would not need to create hold files to do this in every report. Hope this helps. Michelle
-IF &LINES EQ 0 THEN GOTO now_what
-ELSE GOTO FINISHED;
-now_what
-IF &WFFMT = 'HTML' OR &WFFMT = 'AHTML' THEN GOTO NORECS_HTML
-ELSE GOTO NORECS_PDF;
-NORECS_HTML
-HTMLFORM IBFS:/WFC/Repository/Common/html/norecords.htm
-GOTO FINISHED;
-NORECS_PDF
-SET &ERRMSG = IF &FOCERRNUM NE 0 THEN 'Error Number: ' | &FOCERRNUM ELSE '';
-SET &WFFMT = PDF;
-SET &MYORIENT = LANDSCAPE;
-INCLUDE IBFS:/WFC/Repository/Common/fex/sets_2.fex
-*the sets_2.fex works in conjuntion with our
-*mystyle.fex to create our standard style
DEFINE FILE TIME_DIM
NEW_DAY_TIME/HMTDYYIA=HGETC(8, NEW_DAY_TIME);
END
TABLE FILE TIME_DIM
SUM
NEW_DAY_TIME NOPRINT AS ''
TIME_DIM.TIME_DIM.FULL_DATE NOPRINT
HEADING
"&DATEHMTDYYIa "
" "
"There Are No Matching Records"
"Please Review Parameters Chosen and Try Again"
" "
"If you feel you have received this message in error,"
"please contact Administrative Computing at 488.4240. "
" "
"&ERRMSG"
" "
" "
" "
" "
" "
" "
" "
" "
" "
" "
FOOTING BOTTOM
"Page 1 of 1"
ON TABLE SUBFOOT
" "
" "
"- end of report - "
"Report Name:<+0> &REPORTNAME"
"Run By:<+0> &USR"
ON TABLE SET PAGE-NUM OFF
ON TABLE NOTOTAL
ON TABLE PCHOLD FORMAT PDF
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
-INCLUDE IBFS:/WFC/Repository/Common/fex/include_mystyle.fex
-*include_mystyle.fex sets our standard style....you can use your own here.
TYPE=HEADING,
LINE=3,
COLOR='BLACK',
STYLE=BOLD,
SIZE=12,
JUSTIFY=CENTER,
$
TYPE=HEADING,
LINE=4,
COLOR='BLACK',
STYLE=BOLD,
SIZE=12,
JUSTIFY=CENTER,
$
TYPE=HEADING,
LINE=6,
COLOR='BLACK',
STYLE=NORMAL,
JUSTIFY=CENTER,
SIZE=11,
$
TYPE=HEADING,
LINE=7,
COLOR='BLACK',
STYLE=NORMAL,
JUSTIFY=CENTER,
SIZE=11,
$
TYPE=HEADING,
LINE=9,
JUSTIFY=CENTER,
$
TYPE=HEADING,
LINE=9,
SIZE=10,
COLOR='BLACK',
STYLE=NORMAL,
$
TYPE=FOOTING,
SIZE=9,
$
TYPE=REPORT,
COLUMN=N2,
SQUEEZE=4.430556,
$
ENDSTYLE
END
-RUN
-FINISHED
WebFOCUS Server 8.1.05 Windows 2008 Server WebFOCUS AppStudio 8.1.05 Windows 7 Professional IE 11 and Chrome Version 43.0.2357.124 m. Mostly HTML, PDF, Excel, and AHTML
February 21, 2017, 10:39 AM
RobertF
Its working now...I like the no records fex idea too...THANKS!