Focal Point
[CLOSED] FOR FIELD FROM THE DEFINED FIELD

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

June 01, 2010, 10:36 PM
<msam>
[CLOSED] FOR FIELD FROM THE DEFINED FIELD
 DEFINE FILE CAR
CAR1/I11= IF CAR_ID NE '' THEN 1 ELSE 0;
CAR2/I11= IF INF_ID EQ '' THEN 1 ELSE 0;
CTRY/I11= IF LEG_ID EQ '' THEN 1 ELSE 0;
E_IT/I11= IF MAT_ID NE '' THEN 1 ELSE 0;
-*
OPEN_DATE/YYM = HDATE(OPEN_DATE, 'YYMD');
REOPEN_DATE/YYM= HDATE(REOPEN_DATE, 'YYMD');
CLOSE_DATE/YYM= HDATE(CLOSE_DATE, 'YYMD');
OP_C/I11= IF OPEN_DATE LT 200010 THEN 1 ELSE 0;
NEW_C/I11= IF OPEN_DATE GE 200010 THEN 1 ELSE 0;

-*
END 

I was in need of the below o/p from the above DEFINE..
   CAR1  CAR2  CTRY   TOTAL
             -------------------------
OP_C         10    20    30     60
NEW_C        5     5     5      15

This message has been edited. Last edited by: Kerry,
June 02, 2010, 09:38 AM
GinnyJakes
Since OP_C and NEW_C are mutually exclusive from the way you coded them, you only need one field to identify the value which will be 0 or 1. Then you can use a DECODE to give them a name. Please reference the following example:
DEFINE FILE CAR
SORT1/I1=IF COUNTRY EQ 'ENGLAND' THEN 0 ELSE IF COUNTRY EQ 'JAPAN' THEN 1 ELSE 2;
SORTFLD/A10=DECODE SORT1(0 'NEW_C' 1 'OP_C');
END
TABLE FILE CAR
SUM DEALER_COST RETAIL_COST
BY SORT1 NOPRINT
BY SORTFLD AS ''
ON TABLE ROW-TOTAL
WHERE SORT1 LT 2
END

Also, please, please put your code in between the code tags (the red left and right carats to the far right of the ribbon bar) so that it lines up properly.


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