[CLOSED] FIELDNAME OR COMPUTATIONAL ELEMENT NOT RECOGNIZED
I have a DEFINE in my report.In the define I have REVN/I11=IF FLG EQ 'Y' AND KEY EQ '101' OR '102' OR '103' OR '104' OR '105' OR '106' AND CDT GE DT(&BEG_DATE) AND CDT LT DT(&END_DATE) THEN P_REVN ELSE 0;
The error I get is FIELDNAME OR COMPUTATIONAL ELEMENT NOT RECOGNIZED.
Can you please help me.what is the mistake I am making in the above statement. Thanks in advance.This message has been edited. Last edited by: Kerry,
September 29, 2010, 10:17 AM
Francis Mariani
Depending on the format of the date field, you may not require the DT function. Here is a working example:
-SET &BEG_DATE = 20100101;
-SET &END_DATE = 20101231;
DEFINE FILE CAR
FLG/A1 = 'Y';
KEY/A3 = '102';
CDT/YYMD =
IF COUNTRY EQ 'ENGLAND' THEN '20100302' ELSE
IF COUNTRY EQ 'FRANCE' THEN '20080623' ELSE
IF COUNTRY EQ 'JAPAN' THEN '20101215' ELSE '20010306';
P_REVN/I2 = 65;
REVN/I11 = IF
(FLG EQ 'Y') AND
(KEY EQ '101' OR '102' OR '103' OR '104' OR '105' OR '106') AND
(CDT GE '&BEG_DATE' AND CDT LT '&END_DATE')
THEN P_REVN ELSE 0;
END
TABLE FILE CAR
PRINT
REVN
BY COUNTRY
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
September 29, 2010, 02:33 PM
swetha
My BEG_DATE and END_DATE are in YYMD format and CDT is a Date-Time field ,so for the comparison I used DT() function.There is no problem with that.
I think there is a problem with the IF statement. Can somebody help me.
September 29, 2010, 03:49 PM
GamP
quote:
REVN/I11=IF FLG EQ 'Y' AND KEY EQ '101' OR '102' OR '103' OR '104' OR '105' OR '106' AND CDT GE DT(&BEG_DATE) AND CDT LT DT(&END_DATE) THEN P_REVN ELSE 0;
You might want to put in brackets, like
REVN/I11=IF (FLG EQ 'Y') AND
(KEY EQ '101' OR '102' OR '103' OR '104' OR '105' OR '106') AND
(CDT GE DT(&BEG_DATE)) AND
(CDT LT DT(&END_DATE)) THEN P_REVN ELSE 0;
It might just do the trick. If not, one of the fields you use is not in the master file/define list - possibly misspelt.