Focal Point
No Data Message in PDF

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/9141074262

December 20, 2007, 10:16 AM
<GGOFAnalyst>
No Data Message in PDF
I have a drilldown that sometimes shows 0 for the amount so when the user drilldowns there obviously won't be any data. I want to show a message that says "No Data Found" when the user clicks on the drilldown. However, my format is PDF, can that be done in PDF?

Also, do I need to create a new fex or can I do all that in my report that shows what's in the drilldown?
December 20, 2007, 10:24 AM
Prarie
Do a search on this forum and there are many examples of No Data Found fexes. Yes it can be done in PDF. You will have to add the No Data Found at the end of the drill down fex.


In Focus since 1993. WebFOCUS 7.7.03 Win 2003
I searched for how to do it and I came up with this:

-IF &LINES = 0 THEN GOTO NOREPORT ELSE GOTO PRINTOUT;

-NOREPORT
DEFINE FILE CAR
NORPT/A15 = 'NO DATA FOUND';
END

TABLE FILE CAR
PRINT
NORPT AS ''
COUNTRY NOPRINT
WHERE RECORDLIMIT EQ 1

-GOTO HSTYLE

-PRINTOUT

But this doesn't seem to work on PDF.
Use Following Code after -NOREPORT page
-NOREPORT
TABLE FILE CAR
SUM
CAR NOPRINT
HEADING CENTER
""<25>No Data to Display &DATE"
"<25>Date: <+0>&DATE<+0>; Time:<+0> &TOD<+0>"
ON TABLE SET PAGE-NUM OFF
ON TABLE NOTOTAL
ON TABLE PCHOLD FORMAT PDF
END
-EXIT




Env Prod:WebFOCUS 7702 ,Windows xp on 64, SQL Server 2008, IRF Tool
Env 1 Local: DevStudio 7702 - MS Windows XP SP2 - Apache Tomcat 5.0.28
Output: HTML, Excel and PDF
It makes no difference what format of output you've selected for the report. The Dialogue Manager IF statement is executed regardless of format.

-IF &LINES EQ 0 THEN GOTO NOREPORT ELSE GOTO PRINTOUT;

-NOREPORT
-*-- Display empty report message

JOIN CLEAR *
TABLE FILE EXPENSEBASE
PRINT EXPENSEDATE NOPRINT
IF RECORDLIMIT EQ 1
IF READLIMIT EQ 1

ON TABLE SUBHEAD
" "
"-----------------------------------------------------------------------------"
"No Data was found for the selected parameters"
"-----------------------------------------------------------------------------"
" "
" "
ON TABLE HOLD AS HOLDREP1 FORMAT HTMTABLE

ON TABLE SET STYLE *
...
ENDSTYLE
END
-RUN
-EXIT

PRINTOUT
...



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
Francis, I tried that as well in my drilldown report, pretty much exactly what you had. But that doesn't work either.
What is see when I run the report is a PDF file that looks like this:

0

F FYTD Actual
Category
____________________________________
OK, this is most likely because you have SET EMPTYREPORT=ON.

If there is a HOLD file creation prior to the report,do the &LINES test just after the HOLD file creation, or do not code SET EMPTYREPORT=ON.


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
I have the &Line after the HOLD file so I don't think that's the problem.
If I don't code the set emptyreport = on then I just get the No HTML Output screen.
When you use -IF or -SET &.. this is Dialogue Manager. If you have WebFOCUS code (DEFINE, JOIN, TABLE, etc) between the Dialogue Manager code, unless you add a -RUN right after the END statement, the WebFOCUS code will NOT execute until all the Dialogue Manager code executes, so I always make sure I add a -RUN after each END statement and after a set of JOIN statements...


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
Yea I learnt that in the intermediate WebFocus course that I took. So I hate to say it but I have -RUN after every JOIN and every END statement.
Could it be the invalid syntax of the -IF statement:

-IF &LINES = 0

should be

-IF &LINES EQ 0


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
Try this:

Create fex 1 as follows:

-* File testdrilldown.fex
TABLE FILE CAR
SUM
     BODYTYPE
     SALES
BY COUNTRY
BY CAR
BY MODEL
HEADING
""
FOOTING
""
ON TABLE SET PAGE-NUM OFF
ON TABLE NOTOTAL
ON TABLE PCHOLD FORMAT PDF
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
     UNITS=IN,
     SQUEEZE=ON,
     ORIENTATION=PORTRAIT,
$
TYPE=REPORT,
     GRID=OFF,
     FONT='ARIAL',
     SIZE=9,
$
TYPE=DATA,
     COLUMN=N4,
     FOCEXEC=testdrilldown2.fex(CNTRY=N1 CR=N2 BDYTYP=N4),
$
TYPE=DATA,
     COLUMN=N4,
     TARGET='_blank',
$
ENDSTYLE
END
-RUN


Then create drilldown fex (named testdrilldown2.fex) as follows:
-* File testdrilldown2.fex
-DEFAULT &CR='JAGUAR'
-DEFAULT &CNTRY='ENGLAND'
-DEFAULT &BDYTYP='CONVERTIBLE'
TABLE FILE CAR
SUM  COMPUTE DEALER_NET/D7=SALES - DEALER_COST;
BY COUNTRY
BY CAR
BY BODYTYPE
HEADING
""
FOOTING
""
WHERE COUNTRY EQ '&CNTRY';
WHERE CAR EQ '&CR';
WHERE BODYTYPE EQ '&BDYTYP';
WHERE SALES GT 0;
ON TABLE SET PAGE-NUM OFF
ON TABLE NOTOTAL
ON TABLE PCHOLD FORMAT PDF
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
     UNITS=IN,
     SQUEEZE=ON,
     ORIENTATION=PORTRAIT,
$
TYPE=REPORT,
     GRID=OFF,
     FONT='ARIAL',
     SIZE=9,
$
ENDSTYLE
END
-IF &RECORDS NE 0 THEN GOTO ENDFEX;
TABLE FILE CAR
SUM
CAR NOPRINT
HEADING CENTER
"<25>No Data to Display &DATE"
"<25>Date: <+0>&DATE<+0>; Time:<+0> &TOD<+0>"
ON TABLE SET PAGE-NUM OFF
ON TABLE NOTOTAL
ON TABLE PCHOLD FORMAT PDF
ON TABLE SET PAGE-NUM OFF
ON TABLE NOTOTAL
ON TABLE PCHOLD FORMAT PDF
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
     UNITS=IN,
     SQUEEZE=ON,
     ORIENTATION=PORTRAIT,
$
TYPE=REPORT,
     GRID=OFF,
     FONT='ARIAL',
     SIZE=9,
$
ENDSTYLE
END
-ENDFEX
-EXIT


Run the first fex and click on any sales with value greater than 0 and it will report on it. If you click on the 0 sales you should get the No Data message on PDF.

Is this what you need?


WF 8.1.05 Windows
Silly question, but why do you not make it a conditional drilldown?
That way there is never going to an issue.

TABLE FILE CAR
SUM
DEALER_COST
BY COUNTRY
ON TABLE PCHOLD FORMAT HTML
ON TABLE SET STYLE *
TYPE=DATA,COLUMN=COUNTRY,
TARGET='_blank',
FOCEXEC=carinst(COUNTRY=N1),WHEN= DEALER_COST GT 10000,
$
ENDSTYLE
END
I fixed the problem. The problem wasn't the format or how I was calling the &Line. The problem was that I wasn't using a where statement to specify my region.
Thanks everyone.