Focal Point
passing parm on footing when &RECORDS = 0

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/1211000772

March 20, 2008, 12:54 PM
JZMSH
passing parm on footing when &RECORDS = 0
Hi guys,
How can I pass parm when data not exists in Hold file.
Here is what I have:
TABLE FILE TABLE1
PRINT COL1
WHERE USER_ID EQ 'USER1';
ON TABLE HOLD AS A1 FORMAT ALPHA
END
-RUN
-READ A1 &COL1.A20
END

-RUN
-SET &HLINK = IF &RECORDS NE 0 AND &COL1 NE '' THEN 'Drill-Down report with &COL1 view' ELSE '';

It works when &RECORDS NE 0 but when &RECORDS EQ 0, then I got the error message as:
(FOC295) A VALUE IS MISSING FOR: &COL1

Anyone knows how to solve this problem?


Thanks,
March 20, 2008, 01:07 PM
Francis Mariani
Default the variable you will read:

-DEFAULT &COUNTRY = '';

SET HOLDFORMAT=ALPHA
-RUN

TABLE FILE CAR
PRINT COUNTRY
WHERE COUNTRY EQ 'CANADA'
ON TABLE HOLD AS H001
END
-RUN

-READ H001 &COUNTRY.A10.

-TYPE COUNTRY: &COUNTRY



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
March 20, 2008, 02:07 PM
JZMSH
Francis,

I added
-DEFAULT &COL1= '';

Now I got error message as:
Unknown error occurred. Agent on reporting server EDASERVE may have crashed. Please investigate reporting server log.
March 20, 2008, 03:25 PM
JZMSH
-DEFAULT &COUNTRY = '';
-DEFAULT &HLINK = '';

SET HOLDFORMAT=ALPHA
-RUN

TABLE FILE CAR
PRINT COUNTRY
WHERE COUNTRY EQ 'CANADA'
ON TABLE HOLD AS H001
END
-RUN

-READ H001 &COUNTRY.A10.

-RUN
-SET &HLINK = IF &RECORDS NE 0 AND '&COUNTRY' NE '' THEN 'File for: &COUNTRY' ELSE IF &RECORDS NE 0 AND '&COUNTRY' EQ '' THEN 'Done';

-RUN
TABLE FILE CAR
BY COUNTRY
ON TABLE FOOTING
"&HLINK.EVAL"
END
-EXIT

The error message is: (FOC295) A VALUE IS MISSING FOR: &HLINK
March 20, 2008, 03:33 PM
Tom Flynn
-DEFAULT &COUNTRY = ' ';
-DEFAULT &HLINK = ' ';

SET HOLDFORMAT=ALPHA
-RUN

TABLE FILE CAR
PRINT COUNTRY
WHERE COUNTRY EQ 'CANADA'
ON TABLE HOLD AS H001
END
-RUN

-IF &LINES EQ 0 GOTO SKIP_READ;
-READ H001 &COUNTRY.A10.

-***********************
-SET &HLINK = 'File for: ' | &COUNTRY;
-***********************
-SKIP_READ

TABLE FILE CAR
BY COUNTRY
-IF &COUNTRY EQ ' ' GOTO NO_FOOTER;
FOOTING
"&HLINK.EVAL"
-NO_FOOTER
END
-EXIT


Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
March 20, 2008, 03:39 PM
Francis Mariani
You may do as Tom suggests or do this:

-DEFAULT &COUNTRY = '';
-DEFAULT &HLINK = '';

SET HOLDFORMAT=ALPHA
-RUN

TABLE FILE CAR
PRINT COUNTRY
WHERE COUNTRY EQ 'CANADA'
ON TABLE HOLD AS H001
END
-RUN

-READ H001 &COUNTRY.A10.

-RUN
-SET &HLINK = 
-  IF &RECORDS NE 0 AND '&COUNTRY' NE '' THEN 'FILE FOR: &COUNTRY' 
-  ELSE IF &RECORDS NE 0 AND '&COUNTRY' EQ '' THEN 'DONE'
-  ELSE '';

-RUN
TABLE FILE CAR
BY COUNTRY
ON TABLE FOOTING
"&HLINK.EVAL"
END
-EXIT


I added "ELSE ''" to the -SET statement.

As well, I don't think you need the .EVAL in the FOOTING.


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
March 20, 2008, 03:52 PM
JZMSH
Yes, it works.
Thank you both very much!!