Focal Point
[WAZed] Has anyone ever -SET a variable with the field format from a master file?

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

November 29, 2018, 03:35 PM
Don Garland
[WAZed] Has anyone ever -SET a variable with the field format from a master file?
Scenario:

I need to append two files, one with detail information and the other with a summary of the detail. I've done this many time using MORE.

The problem I'm having is, the BY FIELD of the summary file variable. I don't know what field the user will select as the BY FIELD and that format must match for the MORE to work.

Here is an example, I need to find a way to set the &FMT variable based on the BY FIELD the user selects.

Any ideas?

TABLE FILE CAR
SUM
SALES
ON TABLE HOLD AS HOLD1
END
-RUN

DEFINE FILE HOLD1
MODEL/&FMT = 'ALL';
END
TABLE FILE HOLD1
PRINT
SALES
BY MODEL
ON TABLE HOLD AS HOLD2
END


TABLE FILE CAR
SUM
SALES
BY MODEL
ON TABLE HOLD AS HOLD3
MORE
FILE HOLD2
END


TABLE FILE HOLD3
PRINT *
END  

This message has been edited. Last edited by: Don Garland,


WebFOCUS Administrator @ Worldpay FIS
PROD/DEV/TEST: 8204, SANDBOX: 8206 soon - BIP, Reportcaster, Resource Manager, EUM, HyperStage soon, DB: HIVE,Oracle,MSSQL
November 29, 2018, 03:44 PM
Waz
Perhaps use SYSCOLUM to get the format of the field ?


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

November 29, 2018, 04:45 PM
Don Garland
Yep

 TABLE FILE SYSCOLUM
PRINT COLTYPE LENGTH
WHERE TBNAME EQ 'CAR'
WHERE NAME EQ 'MODEL'
-*ON TABLE SAVE
END
-RUN 


Thank you,


WebFOCUS Administrator @ Worldpay FIS
PROD/DEV/TEST: 8204, SANDBOX: 8206 soon - BIP, Reportcaster, Resource Manager, EUM, HyperStage soon, DB: HIVE,Oracle,MSSQL
November 29, 2018, 05:06 PM
Waz
quote:
[WAZed]


You have made my day.

Big Grin


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

November 30, 2018, 02:36 AM
Danny-SRL
Don,
You don't need the format:
  
TABLE FILE CAR
SUM
SALES
BY MODEL
ON TABLE HOLD AS HOLD1
END
DEFINE FILE HOLD1
MODEL=' ALL'
END
TABLE FILE HOLD1
SUM SALES
BY MODEL
ON TABLE HOLD AS HOLD2
END
DEFINE FILE HOLD1 CLEAR
END
TABLE FILE HOLD1
SUM SALES BY MODEL
ON TABLE HOLD AS HOLD3
MORE
FILE HOLD2
END
TABLE FILE HOLD3
SUM SALES
BY MODEL
END



Daniel
In Focus since 1982
wf 8.202M/Win10/IIS/SSA - WrapApp Front End for WF