Focal Point Banner


As of December 1, 2020, Focal Point is retired and repurposed as a reference repository. We value the wealth of knowledge that's been shared here over the years. You'll continue to have access to this treasure trove of knowledge, for search purposes only.

Join the TIBCO Community
TIBCO Community is a collaborative space for users to share knowledge and support one another in making the best use of TIBCO products and services. There are several TIBCO WebFOCUS resources in the community.

  • From the Home page, select Predict: WebFOCUS to view articles, questions, and trending articles.
  • Select Products from the top navigation bar, scroll, and then select the TIBCO WebFOCUS product page to view product overview, articles, and discussions.
  • Request access to the private WebFOCUS User Group (login required) to network with fellow members.

Former myibi community members should have received an email on 8/3/22 to activate their user accounts to join the community. Check your Spam folder for the email. Please get in touch with us at community@tibco.com for further assistance. Reference the community FAQ to learn more about the community.


Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED] Error message for no data

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] Error message for no data
 Login/Join
 
Silver Member
posted
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 :

Pasted code here:



-SET ASNAMES = ON;
-SET &YEAR= EDIT(&YYMD,'9999');
-SET &YEAR = &YEAR -2;
-SET &MONTH= 10 ;
-SET &MONTHNEW = 2;
-SET EMPTYREPORT = OFF;

-DEFAULT &SUBMODULE = '_FOC_NULL';
-DEFAULT &GROUP_COMPANY = '_FOC_NULL';
-DEFAULT &OPERATING_UNIT = '_FOC_NULL';
-DEFAULT &MONTHNAME = 'FEB_2018' ;

DEFINE FILE &MONTHNAME
YEAR/YY=YEAR_OF_CREATING;
YEAR1/A4YY = EDIT(YEAR);
MONTH/M=MOUNT_OF_CREATION;
MONTH1/A2 = EDIT(MONTH);
MONTHYEAR/A7= YEAR1 |'.'| MONTH1;

YEARS/YY=&YEAR;
YEARS1/A4YY = EDIT(YEARS);
MONTHS/M=&MONTH;
MONTHS1/A2 = EDIT(MONTHS);
DATES/A7= YEARS1 |'.'| MONTHS1;
END

-*-SET &MONTHDIFFCURRENT= EDIT(&YYMD,'$$$$99');
-SET &MONTHDIFFCURRENT=2;
-SET &YEARDIFFCURRENT= EDIT(&YYMD,'9999');

-SET &YEARDIFFCURRENT = &YEARDIFFCURRENT -1;

-TYPE &YEARDIFFCURRENT
-TYPE &MONTHDIFFCURRENT
-*-EXIT

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 ;

-READ DIFFRENCE &DIFF.A6.
-SET &DIFFRENCEVALUE = &DIFF ;
-TYPE &DIFFRENCEVALUE ;


-*----------------------------------------------------- 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 ;

-READ LASTVALUE &WBS_COST.A6.
-SET &LASTVALUE = &WBS_COST ;
-TYPE &LASTVALUE ;

-*-------------------------------------------------------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 ;

COMPUTE YEAR4/YY=YEARNEW; NOPRINT
COMPUTE YEARS4/A4YY = EDIT(YEAR4); NOPRINT
COMPUTE MONTH4/M=MONTHNEWVAR; NOPRINT
COMPUTE MONTHS4/A2 = EDIT(MONTH4); NOPRINT
COMPUTE DATES4/A7= YEARS4 |'.'| MONTHS4; NOPRINT

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));


setTransparentBorderColor(getSeries(0),true);
setTransparentBorderColor(getSeries(1),true);
setTransparentBorderColor(getSeries(2),true);
setTransparentBorderColor(getSeries(3),true);
setTransparentBorderColor(getSeries(4),true);
setTransparentBorderColor(getSeries(5),true);
setTransparentBorderColor(getSeries(6),true);
setTransparentBorderColor(getSeries(7),true);
setTransparentBorderColor(getSeries(8),true);
setTransparentBorderColor(getSeries(9),true);

setDepthRadius(0);
setMarkerSizeDefault(100);
setPlace(true);
setLegendDisplay(false);
setLegendAutomatic(false);
setTitleDisplay(true);
setLegendDisplay(getSubtitle(),false);
setFillMissingData(0);
setDataTextDisplay(false);
setDataTextPosition(5);
setStackedDataValueSum(false);
*GRAPH_SCRIPT
setReportParsingErrors(false);
setSelectionEnableMove(false);
setTextRotation(getO1Label(),0);
*END
END


-------------------------------------------------------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 END

This message has been edited. Last edited by: FP Mod Chuck,


WebFOCUS 8
Windows, all Outputs
 
Posts: 29 | Registered: August 22, 2017Report This Post
Guru
posted Hide Post
-*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



WebFOCUS Administrator @ Worldpay FIS
PROD/DEV/TEST: 8204, SANDBOX: 8206 soon - BIP, Reportcaster, Resource Manager, EUM, HyperStage soon, DB: HIVE,Oracle,MSSQL
 
Posts: 291 | Location: Greater Cincinnati  | Registered: May 11, 2005Report This Post
Silver Member
posted Hide Post
quote:
ELSE :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
 
Posts: 29 | Registered: August 22, 2017Report This Post
Virtuoso
posted Hide Post
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
 
Posts: 1853 | Location: New York City | Registered: December 30, 2015Report This Post
Silver Member
posted Hide Post
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
 
Posts: 29 | Registered: August 22, 2017Report This Post
Virtuoso
posted Hide Post
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 :
 
Posts: 1669 | Location: Enschede, Netherlands | Registered: August 12, 2010Report This Post
Virtuoso
posted Hide Post
Take a look at the doc on the subject. It'll explain how to apply the Dialogue Manager commands you are attempting to use.

https://webfocusinfocenter.inf...lang/source/dm49.htm


WebFOCUS 8206, Unix, Windows
 
Posts: 1853 | Location: New York City | Registered: December 30, 2015Report This Post
Silver Member
posted Hide Post
quote:
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
 
Posts: 29 | Registered: August 22, 2017Report This Post
Expert
posted Hide Post
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
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Silver Member
posted Hide Post
OK thanks I got it..... thanks for all your help !!!


WebFOCUS 8
Windows, all Outputs
 
Posts: 29 | Registered: August 22, 2017Report This Post
Guru
posted Hide Post
Try adding a -EXIT before the label
-FOC_ERROR


WF 7.6.11
Oracle
WebSphere
Windows NT-5.2 x86 32bit
 
Posts: 398 | Registered: February 04, 2008Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED] Error message for no data

Copyright © 1996-2020 Information Builders