[SOLVED] Default defined as Decimal when set as String
Why does this work:
-DEFAULT &MYVALUE=10;
DEFINE FILE CAR ADD
NEWVALUE/I11=
IF( &MYVALUE EQ 10) THEN 1
ELSE IF( &MYVALUE EQ 20) THEN 2
ELSE 3;
END
TABLE FILE CAR
PRINT
CAR.COMP.CAR AS '&MYVALUE'
NEWVALUE
END
But this doesn't?
-DEFAULT &MYVALUE='AAA';
DEFINE FILE CAR ADD
NEWVALUE/I11=
IF( &MYVALUE EQ 'AAA') THEN 1
ELSE IF( &MYVALUE EQ 'AAA') THEN 2
ELSE 3;
END
TABLE FILE CAR
PRINT
CAR.COMP.CAR AS '&MYVALUE'
NEWVALUE
END
When looking at this through report painter, I see WebFOCUS is looking at &MYVALUE as a decimal even with I've clearly defaulted it as a string.
Is this a bug or by design?This message has been edited. Last edited by: GavinL,
- FOCUS Man, just FOCUS! ----------------------------- Product: WebFOCUS Version: 8.1.04 Server: Windows 2008 Server
March 05, 2015, 02:50 PM
Francis Mariani
The IF statement is WebFOCUS code, not Dialogue manager code, so you're not comparing a variable to a value, you're comparing a value to a value. The following should work for both alpha and numeric values:
DEFINE FILE CAR ADD
NEWVALUE/I11=
IF '&MYVALUE' EQ 'AAA' THEN 1
ELSE IF '&MYVALUE' EQ 'BBB' THEN 2
ELSE 3;
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
March 05, 2015, 02:57 PM
GavinL
DOH!
Your the man as always..
- FOCUS Man, just FOCUS! ----------------------------- Product: WebFOCUS Version: 8.1.04 Server: Windows 2008 Server