Focal Point
Empty table with WHERE TOTAL
February 02, 2012, 05:30 AM
Wep5622Empty table with WHERE TOTAL
Am I right in assuming this is a bug?
TABLE FILE CAR
SUM CNT.CAR
BY COUNTRY
WHERE TOTAL CNT.CAR EQ 0;
ON TABLE HEADING
"Zero lines, but a heading and column titles"
END
This code gives me an empty table with just a heading and column titles, but no data rows. Shouldn't I be getting the 'No HTML Output!' message instead?
I just accidentally encountered this with a table file on a relatively small set of invoice data that only prints results if the invoice total not equals zero. Getting an "empty" excel sheet from that was a little surprising!
WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010
: Member of User Group Benelux :
February 02, 2012, 05:41 AM
TewyNot a bug, sounds like EMPTYREPORT is set to on.
SET EMPTYREPORT = ON
If there are no records to return then you get a report with column headings and no data as you describe instead on the No HTML Output message.
WF 7.6.11
Output: HTML, PDF, Excel
February 02, 2012, 05:43 AM
Wep5622Nope, it isn't EMPTYREPORT.
The same table file with WHERE CAR EQ '0' instead of the WHERE TOTAL
does result in 'No HTML Output!'.
WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010
: Member of User Group Benelux :
February 02, 2012, 05:48 AM
TewyThis thread deals with the same issue. Seems this is the documented behaviour with WHERE TOTAL
http://forums.informationbuild...267000016#6267000016
WF 7.6.11
Output: HTML, PDF, Excel
February 02, 2012, 06:26 AM
Wep5622Interesting, but in a different way than the people in that thread meant, I think.
So how do I prevent getting an empty report when WHERE TOTAL yields no results?
"I got this car and when I turn off the engine the doors won't open. I called the manufacturer about this and they said that it's not a design fault, but just the way the car behaves. They even referred to the manual where it says the doors won't open if you turn off the engine. So apparently it's not a problem."
WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010
: Member of User Group Benelux :
February 02, 2012, 06:44 AM
TewySomething like this should work
TABLE FILE CAR
SUM CNT.CAR
BY COUNTRY
WHERE TOTAL CNT.CAR EQ 0;
ON TABLE HEADING
"Zero lines, but a heading and column titles"
ON TABLE HOLD AS MYHOLD
END
-RUN
-IF &LINES EQ 0 GOTO :theEnd;
TABLE FILE MYHOLD
PRINT *
END
-:theEnd
WF 7.6.11
Output: HTML, PDF, Excel
February 02, 2012, 07:55 AM
Wep5622I was hoping for a simple way to turn off the EMPTYREPORT-like behaviour, not a workaround. The actual report that's having this issue is quite a bit more complicated than the simple CAR-example I used to point out the issue.
I suppose your workaround would be comparable to installing a remote in the car from before so that you can turn off the engine after you got out. It works, but it's hardly elegant.
For now, I'll just accept the fact that the report is sometimes going to show up empty and report this as a bug.
WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010
: Member of User Group Benelux :
February 02, 2012, 11:23 AM
PrarieHere they explain it some more - I don't think they will say it's a Bug...it's just an annoying fly buzzing around your head while you are stuck in your car.
ibi speakFebruary 02, 2012, 08:28 PM
Dan SatchellAnother work-around. Change the "EQ" to "NE" in the WHERE on FRANCE to generate a report.
TABLE FILE CAR
SUM SALES
BY COUNTRY
WHERE (COUNTRY EQ 'FRANCE');
WHERE TOTAL (SALES NE 0);
ON TABLE HEADING
"Report Heading"
ON TABLE HOLD AS RPTFILE FORMAT EXL2K
END
-*
-RUN
-IF (&LINES NE 0) GOTO :DISPLAY_RPT ;
-*Display whatever message is appropriate here....
-EXIT
-*
-:DISPLAY_RPT
SET HTMLFORMTYPE = XLS
-RUN
-HTMLFORM RPTFILE
WebFOCUS 7.7.05