I am in the process of adding empty report logic to some reports. Can I customize the message when there is no data to display? If so, how?
Thanks!
April 02, 2004, 05:55 PM
Tom Fasso
quote:
Originally posted by rstull: [qb] I am in the process of adding empty report logic to some reports. Can I customize the message when there is no data to display? If so, how?
Thanks! [/qb]
April 02, 2004, 06:02 PM
Tom Fasso
quote:
Originally posted by rstull: [qb] I am in the process of adding empty report logic to some reports. Can I customize the message when there is no data to display? If so, how?
Thanks! [/qb]
Oops. Sorry about that. I tried to post some HTML code after testing -IF &LINES EQ 0 GOTO ERRMSG, but it was rejected by the forum. Tom
April 05, 2004, 08:32 AM
<Grzegorz>
Examples of, one of the method:
TABLE FILE CAR SUM SALES BY COUNTRY WHERE COUNTRY CONTAINS '&CTRY' ON TABLE HOLD END -RUN -**************************************************************** -* If empty report then display message and exit, -* else display the report. -**************************************************************** -IF &RECORDS EQ 0 THEN GOTO :EMPTYRPT ELSE GOTO :DISPREPORT; -:EMPTYRPT -SET &MESSAGE='No data found for COUNTRY containing text: ' | &CTRY; -HTMLFORM BEGIN
&MESSAGE
-HTMLFORM END -GOTO :ENDREPORT; -* -:DISPREPORT TABLE FILE HOLD PRINT * END -GOTO :ENDREPORT; -* -:ENDREPORT
There are plenty of possible modifications of the method. For instance, you can -INCLUDE your "empty report message" page, instead of embedding HTML into FEX - this way you can reuse your "empty report message" page. etc., etc., ... See also how it is solved within the CenturyCorp demo code. (e.g. salerank.fex)
Hope this helps GrzegorzThis message has been edited. Last edited by: <Maryellen>,
April 05, 2004, 01:10 PM
<rstull>
Thanks, that was exactly what I was looking for!
April 05, 2004, 11:26 PM
susannah
rstull, amother idea is a simple way you might like: SET EMPTYREPORT = ON and then if your &LINES is 0, you'll get just the heading and nothing else.
April 06, 2004, 12:59 PM
<rstull>
I tried that initially. But, several of the end users thought since the headings loaded, that there was more data to be displayed. I had the same result with setting it to off. The users thought the page was just loading slowly. My hope, with adding a message, is to clarify the situation for the end user.
Thanks!
April 06, 2004, 11:06 PM
susannah
ah, i see. here's what i do: you could create a line in your heading, say line 2. it is populated by an &var and the &var is defaulted to empty -SET &HEADLINE2 = ' ' ; now, at the end of your fex, -SET &HEADLINE2 = IF &LINES GT 0 THEN ' ' ELSE 'NOPE NO DATA FOR YOU TODAY'; then in your fex HEADING " STUFF" " &HEADLINE2 "
April 07, 2004, 07:50 PM
<rstull>
Thanks for the idea. I tried it, but got the following error message:
0 ERROR AT OR NEAR LINE 19 IN PROCEDURE MEMFEX FOCEXEC * (FOC002) A WORD IS NOT RECOGNIZED: EXEC BYPASSING TO END OF COMMAND
Any ideas?
April 12, 2004, 02:42 PM
<mhuber>
susannah, Is this what you had in mind?
SET EMPTYREPORT=ON -SET &EmptyHead = ' '; TABLE FILE CAR PRINT BODYTYPE BY CAR WHERE COUNTRY EQ 'INVALID' ON TABLE HOLD END -RUN -SET &EmptyHead = IF &LINES GT 0 THEN ' ' ELSE 'Sorry, there''s no data today.'; TABLE FILE HOLD HEADING "&EmptyHead" PRINT * ON TABLE SET STYLE * TYPE=HEADING, COLOR=RED,$ ENDSTYLE END
Is there a way to do this without using a hold file? Thanks, Michael
April 15, 2004, 04:51 PM
webfocuspgm
This code came out of an old WebFocus Users Manual.... still seemed to work....
TABLE FILE CAR HEADING " " PRINT SEATS DEALER_COST RETAIL_COST WARRANTY BY CAR WHERE COUNTRY EQ 'INVALID' END -RUN -IF &LINES EQ 0 GOTO RPT2 ELSE GOTO REPTDONE; -RPT2 -TYPE NO REPORT INFORMATION GENERATED -RUN -QUIT -REPTDONE -EXIT
April 16, 2004, 03:09 PM
Stan
Another option if you want to drop the message into a 'jacket' program that has the same look and feel is to do something along the following lines:
TABLE FILE MFDNAME PRINT * ON TABLE HOLD AS JACDAT FORMAT HTML END -IF &LINES EQ 0 GOTO EMPTRPT; -RUN -GOTO JCKT -EMPTRPT TABLE FILE SMALLFILE "No data was found for the criteria entered" PRINT FIELD NOPRINT ON TABLE HOLD AS JACDAT FORMAT HTML END -RUN -JCKT -HTMLFORM JCKTHTML -EXIT
You then have an html file with the phrase !IBI.FIL.JACDAT; at the point in the html file where you want the phrase to appear..
We use this as a way of making the error message look more friendly and you can customize it however you need to. Also keeps the look and feel the same as the report data which would have dropped into that same jacket.
April 19, 2004, 03:57 PM
susannah
Mikel, yes exactly. you need the &LINES count so i don't see how to get it without creating a holdfile. webfocuspgm, -TYPE won't display html code. rstull, there's probably a typo somewhere in your code. it'll work. just keep tweaking. we're all giving you the same answer, essentially, just different flavors
September 20, 2005, 01:41 PM
stuey
Anybody got this to work with Reporting Objects? TIA
September 20, 2005, 08:29 PM
<Barry>
proc ... -IF &LINES EQ 0 THEN GOTO NODATA; END ...
ENDSTYLE END -GOTO DONE -NODATA -INCLUDE ERRORPAGE END
-DONE Then we used the proc for errorpage
-* File ERRORPAGE.fex TABLEF FILE REPORT PRINT Report_ID NOPRINT HEADING "No data was extracted. Review your criteria and submit again"
ON TABLE SET ONLINE-FMT &fmt ON TABLE SET EMPTYREPORT ON ON TABLE SET PAGE-NUM OFF ON TABLE SET STYLE * UNITS=IN, PAGESIZE=&PSize, LEFTMARGIN=0.250000, RIGHTMARGIN=0.050000, TOPMARGIN=0.250000, BOTTOMMARGIN=0.250000, ORIENTATION=LANDSCAPE, $
TYPE=REPORT, ORIENTATION=LANDSCAPE, $
END
Report table was a very small table that we used - create a table with one row of data