Focal Point
[SOLVED] combine output with MORE and a DEFINEd field

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

August 09, 2019, 03:54 PM
folkie
[SOLVED] combine output with MORE and a DEFINEd field
I want to combine the output (flat file) of 2 TABLE FILEs. Thus, I’m doing the following:

TABLE FILE table1
WHERE filter
SUM fields
BY fields
ON TABLE SAVE FILENAME file.txt

MORE
FILE table2
WHERE fields
END

The above works fine. However, I want to make a slight change and use a DEFINE’d field instead of a real field in the SUM and BY. Thus, I put a DEFINE above the TABLE FILE and I used the DEFINEd field in the SUM and BY. That works fine if I just have one normal TABLE FILE. But if I want to use the DEFINEd field in the original, combined MORE, I get this error:

(FOC952) NO MATCH IS FOUND FOR THE FIELD OF MAIN REQUEST: REAL_NAME

If I put the DEFINE FILE above both the TABLE FILE table1 and the FILE table2, I get this error:

(FOC001) THE NAME OF THE FILE OR THE WORD 'FILE' IS MISSING

(FOC009) INCOMPLETE REQUEST STATEMENT
BYPASSING TO END OF COMMAND
(FOC1517) UNRECOGNIZED COMMAND FILE FY2019
(FOC1517) UNRECOGNIZED COMMAND WHERE VENDOR_NO GE '1000000000'
(FOC1517) UNRECOGNIZED COMMAND AND AOBJ GE '0101'
(FOC1517) UNRECOGNIZED COMMAND AND AOBJ LE '0220';

Is there a way to combine output using MORE along with a DEFINEd field?

Thanks,
Mark

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


WF 8.2.02
App Studio
DataMigrator
ReportCaster
Windows Server 2016
August 11, 2019, 03:52 AM
Jean-Claude CARRIERE
I think you need to create your defined field for both table1 and table2. Did you try Something like this :

DEFINE FILE table1
DEF1 =
END
DEFINE FILE table2
DEF1 =
END
Then your TABLE FILE with MORE
August 12, 2019, 07:30 AM
MartinY
When using MORE, all combined files must have the same number of field, same field name/format/length
Sample
TABLE FILE CAR
PRINT RETAIL_COST
BY COUNTRY
BY CAR
BY MODEL
WHERE SEATS EQ 2;
ON TABLE HOLD AS TBL1
END
-RUN

TABLE FILE CAR
PRINT RETAIL_COST
BY COUNTRY
BY CAR
BY MODEL
WHERE MODEL CONTAINS '2 DOOR';
ON TABLE HOLD AS TBL2
END
-RUN

DEFINE FILE TBL1
FLD /A10V = 'TABLE 1';
END
DEFINE FILE TBL2
FLD /A10V = 'TABLE 2';
END
TABLE FILE TBL1
PRINT RETAIL_COST
BY FLD
BY COUNTRY
BY CAR
BY MODEL
MORE
FILE TBL2
END
-RUN



WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
August 12, 2019, 10:45 AM
folkie
Jean-Claude and Martin,

Thanks for both of your replies. I went with the first, and simpler one. I moved the 2nd DEFINE right under the first DEFINE and before the (first) TABLE FILE and it worked.

Thanks again.

Mark


WF 8.2.02
App Studio
DataMigrator
ReportCaster
Windows Server 2016