Focal Point
[SOLVED] A value is missing and using substr in an iff

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

June 16, 2009, 04:08 PM
BDAVIS
[SOLVED] A value is missing and using substr in an iff
I have a report with two versions, excel and PDF. There are two columns in the report with long character lengths, description and comments, and I want to use substr on the PDF version to limit the character length of these two columns and no substr on the excel version.

I had set this up using two prints and a goto for excel, but am told I shouldn't do it this way and should use a variable instead.

This is the basic logic of my report
-SET &COMMENTS = IF &FORMAT EQ 'P' THEN COMMENTS_CUT ELSE COMMENTS;
-SET &DESCRIPY = IF &FORMAT EQ 'P' THEN DESCRIPTION_CUT ELSE DESCRIPTION;

In define:
DESCRIPTION_CUT/A50 = SUBSTR(50, DESCRIPTION, 1, 50, 50, 'A50');
COMMENTS_CUT/A50 = SUBSTR(50, COMMENTS, 1, 50, 50, 'A50');

Table file:
PRINT CONTAINER_NAME AS 'Container,Name'
&DESCRIPY AS 'Description'
ROOM_NUMBER AS 'Room #'
STATUS AS 'Status'
STATUS_EFFECTIVE_DATE2 AS 'Status,Effective Date'
&COMMENTS AS 'Comments'
-GOTO RESUME

But when I run I get (FOC295) A VALUE IS MISSING FOR: &DESCRIPY. What is wrong with my IF statement?

This message has been edited. Last edited by: BDAVIS,


WebFOCUS 7.6.3 | Solaris 10 | Excel, PDF
June 16, 2009, 04:22 PM
GinnyJakes
I don't know. This works:
-SET &ECHO=ALL;
-SET &FORMAT='P';
-SET &COMMENTS = IF &FORMAT EQ 'P' THEN COMMENTS_CUT ELSE COMMENTS; 
-SET &DESCRIPY = IF &FORMAT EQ 'P' THEN DESCRIPTION_CUT ELSE DESCRIPTION; 
-TYPE &COMMENTS &DESCRIPY
DEFINE FILE CAR
DESCRIPTION_CUT/A5 = SUBSTR(5, COUNTRY, 1, 5, 5, 'A5');
COMMENTS_CUT/A5 = SUBSTR(5, CAR, 1, 5, 5, 'A5'); 
END
TABLE FILE CAR
PRINT COUNTRY AS 'Container,Name'
&DESCRIPY AS 'Description'
&COMMENTS AS 'Comments'
END


What is &FORMAT set to when you get the error?


Ginny
---------------------------------
Prod: WF 7.7.01 Dev: WF 7.6.9-11
Admin, MRE,self-service; adapters: Teradata, DB2, Oracle, SQL Server, Essbase, ESRI, FlexEnable, Google
June 16, 2009, 04:23 PM
BDAVIS
Both 'P' and 'E' (PDF & Excel respectively)


WebFOCUS 7.6.3 | Solaris 10 | Excel, PDF
June 16, 2009, 04:29 PM
GinnyJakes
After your two -SET statements add a -TYPE for all the variables, including &FORMAT. Follow that with a -EXIT. Let me know what you get.


Ginny
---------------------------------
Prod: WF 7.7.01 Dev: WF 7.6.9-11
Admin, MRE,self-service; adapters: Teradata, DB2, Oracle, SQL Server, Essbase, ESRI, FlexEnable, Google
June 16, 2009, 04:32 PM
BDAVIS
Odd, now it's working. Looks like there was an erroneous -type written at the end of my define statement that I missed.Thanks for the help, Ginny.


WebFOCUS 7.6.3 | Solaris 10 | Excel, PDF
June 16, 2009, 04:39 PM
GinnyJakes
That's another reason. Smiler I often forget the END statement after all of the defines, or the semicolon. It'll get you everytime.


Ginny
---------------------------------
Prod: WF 7.7.01 Dev: WF 7.6.9-11
Admin, MRE,self-service; adapters: Teradata, DB2, Oracle, SQL Server, Essbase, ESRI, FlexEnable, Google