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,
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
In Focus since 1982
wf 8.202M/Win10/IIS/SSA - WrapApp Front End for WF
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.
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).
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 ENDThis message has been edited. Last edited by: SriAravind,
WebFocus Version 7.7.05
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.
|Powered by Social Strata|