Hello I am writing a code for a fex in which i need to display an error msg if there is no data available in the report i have it pops up message when there is data as well :
TABLE FILE &MONTHNAME SUM WBS_COST BY HIGHEST YEAR_OF_CREATING BY HIGHEST MOUNT_OF_CREATION BY MONTHYEAR WHERE STATUS EQ 'Open' ; WHERE CR_CATEGORIE EQ 'Major' ; WHERE MONTHYEAR GE DATES ; WHERE MONTHYEAR LT '2017.03'; WHERE SUBMODULE EQ '&SUBMODULE' ; WHERE GROUP_COMPANY_ EQ '&GROUP_COMPANY' ; WHERE OPERATING_UNIT_ EQ '&OPERATING_UNIT' ; ON TABLE HOLD AS 'HOLDDIFF' FORMAT ALPHA END
-SET &MONTHDIFFCURRENT= &MONTHDIFFCURRENT - 1;
TABLE FILE HOLDDIFF SUM COMPUTE DIFF/D9.2 = LAST WBS_COST - WBS_COST; BY HIGHEST YEAR_OF_CREATING BY HIGHEST MOUNT_OF_CREATION ON TABLE HOLD AS 'HOLDDIFFCOMPUTE' FORMAT ALPHA END
-*--------------------------------------------------------Difference last two month Value-----------------------------------------------------------
TABLE FILE HOLDDIFFCOMPUTE PRINT DIFF WHERE YEAR_OF_CREATING EQ &YEARDIFFCURRENT; WHERE MOUNT_OF_CREATION EQ &MONTHDIFFCURRENT; ON TABLE HOLD AS 'DIFFRENCE' FORMAT ALPHA END -RUN -IF &LINES EQ 0 GOTO FOC_ERROR ;
-*----------------------------------------------------- Create a LAST VALUE ------------------------------------------------------------------------------
TABLE FILE HOLDDIFF PRINT WBS_COST -*COMPUTE COUNTER/D6 = 1 ; ON TABLE HOLD AS 'LASTVALUE' FORMAT ALPHA END -RUN -IF &LINES EQ 0 GOTO FOC_ERROR ;
-*-------------------------------------------------------Addition of forecasting-----------------------------------------------------------------------------
TABLE FILE HOLDDIFF PRINT MONTHYEAR WBS_COST YEAR_OF_CREATING MOUNT_OF_CREATION COMPUTE COUNTER/D6 = 1 ; BY YEAR_OF_CREATING NOPRINT BY MOUNT_OF_CREATION NOPRINT ON TABLE HOLD AS 'ORIGINAL' FORMAT ALPHA END
TABLE FILE HOLDDIFF PRINT MONTHYEAR WBS_COST YEAR_OF_CREATING MOUNT_OF_CREATION COMPUTE COUNTER/D6 = 2 ; BY YEAR_OF_CREATING NOPRINT BY MOUNT_OF_CREATION NOPRINT ON TABLE HOLD AS 'DUPLICATE' FORMAT ALPHA END
-*------------------------------------------------------------------APPEND ORIGINAL & DUPLICATE USING MORE------------------------------------------------------
TABLE FILE ORIGINAL PRINT * ON TABLE HOLD AS MOREOUT MORE FILE DUPLICATE END
-*-----------------------------------------------------------------HOLD File for GRAPH-------------------------------------------------------------------------
TABLE FILE MOREOUT PRINT
COUNTER NOPRINT COMPUTE YEARNEW/I7 = IF COUNTER EQ 1 THEN YEAR_OF_CREATING ELSE 2018 ; NOPRINT COMPUTE MONTHNEWVAR/I7 = IF COUNTER EQ 1 THEN MOUNT_OF_CREATION ELSE LAST MONTHNEWVAR + 1 ; NOPRINT COMPUTE FLAG/I2 = IF COUNTER EQ 2 THEN FLAG + 1 ELSE 0; NOPRINT COMPUTE NEWVALUE/I7 = IF COUNTER EQ 2 THEN &LASTVALUE + (FLAG * &DIFFRENCEVALUE) ELSE WBS_COST ;
BY DATES4 ON TABLE HOLD AS 'SAP_CR' FORMAT ALPHA END
-*--------------------------------------------------------------GRAPH File for SAP CR Pipeline------------------------------------------------------------------
GRAPH FILE SAP_CR PRINT NEWVALUE AS '' BY DATES4 AS '' ON GRAPH SET LOOKGRAPH VBAR -*ON GRAPH PCHOLD AS CHART3 FORMAT JSCHART ON GRAPH SET GRAPHEDIT SERVER ON GRAPH SET 3D OFF ON GRAPH SET VZERO OFF ON GRAPH SET GRID OFF ON GRAPH SET HAXIS 758 ON GRAPH SET VAXIS 415 ON GRAPH SET UNITS PIXELS ON GRAPH SET GRMULTIGRAPH 0 ON GRAPH SET GRLEGEND 0 ON GRAPH SET GRXAXIS 3 ON GRAPH SET BARNUMB ON ON GRAPH SET GRAPHSTYLE * setTextString(getTitle(),"Request for Change (Major) – Cost"); setTextDisplay(getTitle(),true); setReportParsingErrors(false); setSelectionEnableMove(false); setRiserWidth(25); setFillColor(getSeries(0),new Color(53,125,145)); setFillColor(getSeries(1),new Color(53,125,145)); setFillColor(getSeries(2),new Color(53,125,145)); setFillColor(getSeries(3),new Color(53,125,145)); setFillColor(getSeries(4),new Color(53,125,145)); setFillColor(getSeries(5),new Color(0,60,125)); setFillColor(getSeries(6),new Color(0,60,125)); setFillColor(getSeries(7),new Color(0,60,125)); setFillColor(getSeries(8),new Color(0,60,125)); setFillColor(getSeries(9),new Color(0,60,125));
-------------------------------------------------------TABLE File for SAP CR Pipeline----------------------------------------------------------------------
TABLE FILE SAP_CR SUM NEWVALUE ACROSS DATES4 AS '' ON TABLE SET PAGE-NUM NOLEAD ON TABLE SET ASNAMES ON ON TABLE PCHOLD FORMAT HTML ON TABLE SET HTMLEMBEDIMG ON ON TABLE SET HTMLCSS ON ON TABLE SET STYLE * INCLUDE = endeflt, $ TYPE=REPORT, BORDER=ON, GRID=ON, SQUEEZE=OFF, FONT=CALIBRI, WRAP=0.32000, $ ENDSTYLE END
-FOC_ERROR -SET &FOC_ERRMSG = FEXERR(&FOCERRNUM,'A100'); -HTMLFORM BEGIN No Data Available for 'Request for change cost' report , Please verify filters -
-HTMLFORM ENDThis message has been edited. Last edited by: FP Mod Chuck,
WebFOCUS 8 Windows, all Outputs
April 13, 2018, 06:15 AM
Don Garland
-*Examine the output by using the &RECORDS or &LINES variables that are automatically generated after your fex runs.
-*If the procedure returns NO RECORDS, then present an ERROR PAGE.
TABLE FILE SAP_CR
SUM
NEWVALUE
ACROSS
DATES4 AS ''
ON TABLE SET PAGE-NUM NOLEAD
ON TABLE SET ASNAMES ON
ON TABLE PCHOLD FORMAT HTML
ON TABLE SET HTMLEMBEDIMG ON
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
INCLUDE = endeflt,
$
TYPE=REPORT, BORDER=ON, GRID=ON, SQUEEZE=OFF, FONT=CALIBRI, WRAP=0.32000,
$
ENDSTYLE
END
-IF &RECORDS EQ 0 THEN GOTO :NODATAFOUND ELSE :ENDOFILE;
-GOTO :ENDOFILE
-:NODATAFOUND
-HTMLFORM BEGIN
<html>
<head>
<div>
<div style="width:100%;float:left;padding:5;margin:5;vertical-align: middle;text-align: center; color: red" >
<span style="font-size:18">No Data Found</span>
</div>
</div>
-*
</body>
</html>
-HTMLFORM END
-:ENDOFILE
I tried to do that in my code by modifying IF &LINES EQ 0 GOTO FOC_ERROR it with :ENDOFFILE
and adding a similar code to the end of the page somehow its not working accordingly
WebFOCUS 8 Windows, all Outputs
April 13, 2018, 08:12 AM
BabakNYC
Here's a sample file based version of Don's code. Can you test it and see if it works? Try CHINA for country. If it does, you should be able to just reuse his code by replacing just the TABLE FILE... END with your own.
TABLE FILE CAR
SUM
SALES
WHERE COUNTRY EQ '&COUNTRY';
END
-IF &RECORDS NE 0 THEN GOTO :ENDOFILE;
-HTMLFORM BEGIN
<html>
<head>
<div>
<div style="width:100%;float:left;padding:5;margin:5;vertical-align: middle;text-align: center; color: red" >
<span style="font-size:18">No Data Found</span>
</div>
</div>
-*
</body>
</html>
-HTMLFORM END
-:ENDOFILE
WebFOCUS 8206, Unix, Windows
April 16, 2018, 03:01 AM
asamant59
The code mentioned by me above in that I want the error message to only pop up when there is a wrong or error selection. But I get the error msg also when the report is running. What corrections do I need to make ??
WebFOCUS 8 Windows, all Outputs
April 16, 2018, 04:19 AM
Wep5622
You need to "jump" over the error message when you do have output. The way it is now, after the last TABLE FILE the code just continues on into the error code.
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 :
April 16, 2018, 08:13 AM
BabakNYC
Take a look at the doc on the subject. It'll explain how to apply the Dialogue Manager commands you are attempting to use.
Originally posted by Wep5622: You need to "jump" over the error message when you do have output. The way it is now, after the last TABLE FILE the code just continues on into the error code.
I have added the particular line of code where i an facing this issue. -IF &LINES NE 0 GOTO :ENDOFILE; and then after html end added -:ENDOFILE
It gives me an output saying: 2017 2 0 NUMBER OF RECORDS IN TABLE= 28 LINES= 5 0 NUMBER OF RECORDS IN TABLE= 5 LINES= 5 0 NUMBER OF RECORDS IN TABLE= 1 LINES= 1
WebFOCUS 8 Windows, all Outputs
April 17, 2018, 12:07 PM
Francis Mariani
You need a -RUN statement after the END statement and before the -IF statement. For consistency, I ALWAYS have a -RUN after an END.
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
April 18, 2018, 05:51 AM
asamant59
OK thanks I got it..... thanks for all your help !!!
WebFOCUS 8 Windows, all Outputs
April 18, 2018, 10:28 AM
RSquared
Try adding a -EXIT before the label -FOC_ERROR
WF 7.6.11 Oracle WebSphere Windows NT-5.2 x86 32bit