Focal Point Banner
Community Center Education Summit Technical Support User Groups
Let's Get Social!

Facebook Twitter LinkedIn YouTube
Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [CLOSED] Displaying message when the report is empty for multiple Excel tabs
Go
New
Search
Notify
Tools
Reply
  
[CLOSED] Displaying message when the report is empty for multiple Excel tabs
 Login/Join
 
Silver Member
posted
Hi,

My requirement is to produce multiple Excel tabs.If there are no records in one particular tab I should display "There are no records".

 

SET COMPOUND=OPEN

TABLE FILE CAR
PRINT SEATS
WHERE SEATS EQ '2';
ON TABLE PCHOLD FORMAT EXL2K
END

-IF &LINES EQ 0 THEN GOTO TABLE1 ELSE GOTO OTHERS;

-TABLE1
TABLE FILE CAR
PRINT SEATS NOPRINT
HEADING
"There are no records"
ON TABLE PCHOLD FORMAT EXL2K
END

-OTHERS
SET COMPOUND=CLOSE

TABLE FILE CAR
PRINT SEATS
WHERE SEATS EQ '6';
ON TABLE PCHOLD FORMAT EXL2K
END

-IF &LINES EQ 0 THEN GOTO TABLE2 ELSE GOTO OTHERS1;

-TABLE2

TABLE FILE CAR
PRINT SEATS NOPRINT
HEADING
"There are no records"
ON TABLE PCHOLD FORMAT EXL2K
END

-OTHERS1

-EXIT


 


Here is my code.If the first report(tab) has zero records, the message is being displayed correctly.But for the second tab,if there are zero records I don't see the second tab with the messagae.I am not sure why this is happening.where am I going wrong.Could some one help me.

Thanks

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


WebFOCUS 7.6.7
windows
Html,Pdf and Excel
 
Posts: 39 | Registered: September 03, 2010Reply With QuoteReport This Post
Expert
posted Hide Post
Because it's a compound report, the second report closes the compound report, even though there's no data. Here is one solution - create a compound report with a dummy last report:

SET COMPOUND=OPEN
-RUN

TABLE FILE CAR
PRINT SEATS
WHERE SEATS EQ 2;
ON TABLE PCHOLD FORMAT EXL2K
END
-RUN

-IF &LINES EQ 0 THEN GOTO TABLE1 ELSE GOTO OTHERS;

-TABLE1
TABLE FILE CAR
PRINT SEATS NOPRINT
HEADING
"There are no records"
ON TABLE PCHOLD FORMAT EXL2K
END
-RUN

-OTHERS
TABLE FILE CAR
PRINT SEATS
WHERE SEATS EQ 6;
ON TABLE PCHOLD FORMAT EXL2K
END
-RUN

-IF &LINES EQ 0 THEN GOTO TABLE2 ELSE GOTO OTHERS1;

-TABLE2

TABLE FILE CAR
PRINT SEATS NOPRINT
HEADING
"There are no records"
ON TABLE PCHOLD FORMAT EXL2K
END
-RUN

-OTHERS1

SET COMPOUND=CLOSE
-RUN

TABLE FILE CAR
PRINT SEATS
WHERE SEATS EQ 999;
ON TABLE PCHOLD FORMAT EXL2K
END
-RUN

-EXIT


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
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Reply With QuoteReport This Post
Silver Member
posted Hide Post
That was helpful.Is this the only way to do this.


WebFOCUS 7.6.7
windows
Html,Pdf and Excel
 
Posts: 39 | Registered: September 03, 2010Reply With QuoteReport This Post
Expert
posted Hide Post
I think this is the only way.


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
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Reply With QuoteReport This Post
Gold member
posted Hide Post
Another possible way is to add this to the top of your report

SET EMPTYREPORT = ANSI


Although it will not say "There are no records" it will just not have any data rows but keeps everything else (heading, footing, and column titles). If that would be okay for your requirement instead.


WF: 8201, OS: Windows, Output: HTML, PDF, Excel
 
Posts: 78 | Registered: November 08, 2010Reply With QuoteReport This Post
Gold member
posted Hide Post
Add SET EMPTYREPORT = ON (or ANSI) and omit your branching statements.


WF 7703M, XP/Win7, MRE, RC, BID, PMF, HTML, PDF, Excel 2000/7/10
 
Posts: 73 | Location: NY | Registered: February 06, 2007Reply With QuoteReport This Post
Member
posted Hide Post
SET EMPTYREPORT = ON

SET COMPOUND=OPEN

TABLE FILE CAR
PRINT SEATS
WHERE SEATS EQ '2';
ON TABLE PCHOLD FORMAT EXL2K
ON TABLE SET STYLE *
TYPE=REPORT, FONT='Arial', SIZE=8, STYLE=NORMAL, TITLETEXT='Report 1',$
ENDSTYLE
END

TABLE FILE CAR
PRINT SEATS NOPRINT
HEADING
"There are no records"
ON TABLE PCHOLD FORMAT EXL2K
ON TABLE SET STYLE *
TYPE=REPORT, FONT='Arial', SIZE=8, STYLE=NORMAL, TITLETEXT='Empty 1',$
ENDSTYLE
END

TABLE FILE CAR
PRINT SEATS
WHERE SEATS EQ '6';
ON TABLE PCHOLD FORMAT EXL2K
ON TABLE SET STYLE *
TYPE=REPORT, FONT='Arial', SIZE=8, STYLE=NORMAL, TITLETEXT='Report 2',$
ENDSTYLE
END

SET COMPOUND=CLOSE

TABLE FILE CAR
PRINT SEATS NOPRINT
HEADING
"There are no records"
ON TABLE PCHOLD FORMAT EXL2K
ON TABLE SET STYLE *
TYPE=REPORT, FONT='Arial', SIZE=8, STYLE=NORMAL, TITLETEXT='Empty 2',$
ENDSTYLE
END
 
Posts: 12 | Location: Dallas, TX | Registered: November 02, 2011Reply With QuoteReport This Post
Member
posted Hide Post
quote:
SET EMPTYREPORT = ANSI

SET EMPTYREPORT = ANSI

That did it for me.. thanks a lot


WebFocus 768
Windows, all output
 
Posts: 18 | Registered: June 20, 2011Reply With QuoteReport This Post
  Powered by Social Strata  
 

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [CLOSED] Displaying message when the report is empty for multiple Excel tabs

Copyright © 1996-2018 Information Builders, leaders in enterprise business intelligence.