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     [solved] - Verifing that data was retrieved
Go
New
Search
Notify
Tools
Reply
  
[solved] - Verifing that data was retrieved
 Login/Join
 
Guru
posted
What is the best way to test for data being retrieved so that if there isn't any data I can display a screen saying that there isn't any data instead of the response that looks like an error.

This message has been edited. Last edited by: Jay Potter,


WebFocus 8.1.5
iSeries/Windows
DB2/SQL/Access
Dev Studio
App Studio
Maintain
ReportCaster
 
Posts: 341 | Location: Pembroke NH/Jericho NY | Registered: June 15, 2011Reply With QuoteReport This Post
Virtuoso
posted Hide Post
Jay,

At the end of the report, after the END statement, you can add a test on the variable &RECORDS. Something like this:
  
...
END
-RUN
-IF &RECORDS GT 0 GOTO #DONE;
-HTMLFORM BEGIN
No records retrieved
-HTMLFORM END
-#DONE


Daniel
In Focus since 1982
wf 8.202M/Win10/IIS/SSA - WrapApp Front End for WF

 
Posts: 1936 | Location: Tel Aviv, Israel | Registered: March 23, 2006Reply With QuoteReport This Post
Expert
posted Hide Post
I would suggest using &LINEs and not &RECORDS, as the &RECORDS indicates the number retrieved, and &LINES the number after sorting aggregation and WHERE TOTAL tests.


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.06OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Know The Code

 
Posts: 6131 | Location: 33.8688° S, 151.2093° E | Registered: October 31, 2006Reply With QuoteReport This Post
Virtuoso
posted Hide Post
Unless your HOLDing your data before attempting to produce a report, also make sure EMPTYREPORT is set to OFF for your control logic on &LINES to kick in appropriately. EMPTYREPORT ON/ANSI does force the creation of report output so by the time you're evaluating &LINES it may be too late for your NO DATA message to be displayed (this is most likely to happen in PDF output).



Prod/Dev: WF Server 8008/Win 2008 - WF Client 8008/Win 2008 - Dev. Studio: 8008/Windows 7 - DBMS: Oracle 11g Rel 2
Test: Dev. Studio 8008 /Windows 7 (Local) Output:HTML, EXL2K.
 
Posts: 1533 | Registered: August 12, 2005Reply With QuoteReport This Post
Gold member
posted Hide Post
You can display the error message with appropriate details for your selected input parameters as below:

  
.
.
.
-*After the end of report
-IF &LINES EQ 0 THEN GOTO NODATA;
-ELSE GOTO THEEND;

-NODATA
-SET &ERRMSG1 = 'There is no data retrieved for your given parameters.';
-SET &ERRMSG2 = 'Input 1:' | &ip1;
-SET &ERRMSG3 = 'Input 2:' | &ip2;

-GOTO ERRORMSG

-ERRORMSG

-HTMLFORM BEGIN
<HTML>
<BODY>
<P> &ERRMSG1 </P>
<P> &ERRMSG2 </P>
<P> &ERRMSG3 </P>
</BODY>
</HTML>
-HTMLFORM END

-THEEND
END

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


WebFocus Version 7.7.05
Windows, HTML/PDF/EXL2K/AHTML
 
Posts: 63 | Registered: January 12, 2011Reply With QuoteReport This Post
Guru
posted Hide Post
Thank you for all of the suggestions. I went with the &LINES suggestion. I then display a report with our company header and a line indicating that no information was pulled.


WebFocus 8.1.5
iSeries/Windows
DB2/SQL/Access
Dev Studio
App Studio
Maintain
ReportCaster
 
Posts: 341 | Location: Pembroke NH/Jericho NY | Registered: June 15, 2011Reply With QuoteReport This Post
  Powered by Social Strata  
 

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [solved] - Verifing that data was retrieved

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