September 12, 2013, 07:53 AM
SSB26How to throw any message if there is no data (&LINES=0)
Hi all,
I have created reporting object which is based on the JOIN between two tables. Lets take EMPLOYEE and MANAGER are the two tables. I am joining them on the basis of EMP_ID. When I want to fetch MNGR_NAME for a criteria "WHERE MNGR_SALARY GE '1000000' " , for some EMP_ID it fetches data but for some EMP_ID it doesn't fetch any data. So, when there is no data to display it prints the Columnm names of the report which is not supposed to be printed.
Can anyone tell me how I can simply print or type a message in output like 'No Data for this EMP_ID', so that i can avoid blank report getting populated.
Any suggestion will be greatly appreciated.
Thanks,
Sagar
September 12, 2013, 09:15 AM
MichaelBalleThe display of column names for an empty report or not is controlled by the parameter
SET EMPTYREPORT = {ON | OFF}
The solution for displaying a message for an emtyp report may look like this:
SET EMPTYREPORT = ON
-*SET EMPTYREPORT = OFF
SET PAGE-NUM = OFF
-SET &COUNTRY = 'HUNGARY';
TABLE FILE CAR
SUM
RETAIL_COST
DEALER_COST
BY COUNTRY
BY CAR
BY MODEL
WHERE COUNTRY EQ '&COUNTRY'
-* ON TABLE HOLD AS test
END
-RUN
-IF (&LINES LE 0) THEN GOTO :noRecs;
TABLE FILE test
SUM
RETAIL_COST
DEALER_COST
BY COUNTRY
BY CAR
BY MODEL
END
-RUN
-GOTO :end
-:noRecs
-TYPE There is no result for country &COUNTRY
-:end
September 27, 2013, 03:20 AM
SSB26Sorry for late reply!
Thanks Michael!
"SET EMPTYREPORT = ON " does really helped.
Thanks again!
Sagar