Focal Point
Using the IN FILE option

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

October 04, 2006, 04:54 PM
Spence
Using the IN FILE option
I have a need to use two IN FILE filters in one fex. FOCUS does not allow this, does anyone know a work around?
FILEDEF EUROPE DISK C:\ibi\apps\TEMPFILE\EUROPE.ftm
FILEDEF ASIA DISK C:\ibi\apps\TEMPFILE\ASIA.ftm
DEFINE FILE CAR
ITEM7/D12.2 = IF COUNTRY IN FILE EUROPE THEN SALES ELSE 0;
ITEM8/D12.2 = IF COUNTRY IN FILE ASIA THEN SALES ELSE 0;
END
TABLE FILE CAR
SUM ITEM7 ITEM8
END


WF 8 version 8.2.04. Windows.
In focus since 1990.
October 04, 2006, 05:23 PM
Tom Flynn
Spence, FOCUS/WebFOCUS does allow this:

DEFINE FILE CAR
SEL1/I1 = DECODE COUNTRY(ASIA ELSE 1);
SEL2/I1 = DECODE COUNTRY(EUROPE ELSE 1);
ITEM7/D12.2 = IF SEL2 EQ 0 THEN SALES ELSE 0;
ITEM8/D12.2 = IF SEL1 EQ 0 THEN SALES ELSE 0;
END
TABLE FILE CAR
SUM ITEM7 ITEM8
END


Use the DDNAME in the DECODE...Tom


Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
October 04, 2006, 05:31 PM
Francis Mariani
This is what I'd do:

Change the contents of the selection files to have single quotes around each value and each value ending with a comma (I am assuming you're generating these files in previous TABLE commands):

Europe:
'ENGLAND',
'ITALY',

Asia:
'JAPAN',
'KOREA',

Then use the files as fexes in -INCLUDE statements. Change the DEFINE IF statements, the INCLUDEs will pull in the files as values in the IN('a','b','c') statement. Because the files are generated with a TABLE they will most likely have a comma on the last value, that's why the '' is there before the closing ) of the IN statment.
-SET &ECHO=ALL;
FILEDEF EUROPE DISK C:\IBI\APPS\TEMP\EUROPE.FTM
FILEDEF ASIA DISK C:\IBI\APPS\TEMP\ASIA.FTM
-RUN
DEFINE FILE CAR
ITEM7/D10 = IF COUNTRY IN (
-INCLUDE EUROPE
'') THEN SALES ELSE 0;
ITEM8/D10 = IF COUNTRY IN (
-INCLUDE ASIA
'') THEN SALES ELSE 0;
END
TABLE FILE CAR
SUM
SALES
ITEM7
ITEM8
BY COUNTRY
END


With ECHO=ALL, the program looks like this:
FILEDEF EUROPE DISK C:\IBI\APPS\TEMP\EUROPE.FTM
FILEDEF ASIA DISK C:\IBI\APPS\TEMP\ASIA.FTM
-RUN
DEFINE FILE CAR
ITEM7/D10 = IF COUNTRY IN (
'ENGLAND',
'ITALY',
'') THEN SALES ELSE 0;
ITEM8/D10 = IF COUNTRY IN (
'JAPAN',
'KOREA',
'') THEN SALES ELSE 0;
END
TABLE FILE CAR
SUM
SALES
ITEM7
ITEM8
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
October 04, 2006, 05:33 PM
Francis Mariani
Tom, that's certainly easier!


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
October 05, 2006, 09:13 AM
Spence
Tom and Francis thanks for the responses.

Tom, the decode works great. Thanks for your help.

ds


WF 8 version 8.2.04. Windows.
In focus since 1990.