Focal Point
[SOLVED]variable master

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

June 07, 2019, 08:32 AM
Guilaine
[SOLVED]variable master
Good morning,


We have a question concerning master files with Excel files. We would like to know if it is possible that the same master file could read from different files with a variable that is set in the parameters of the report caster. I will show you with an example.

Excel files:
excel_file_1.xlsx
excel_file_2.xlsx
excel_file_3.xlsx

Master file:
excel_file_x.mas

The idea would be to use it as follows:
"
SET &file_number = "parameter from report caster";

SET &table_name = EXCEL_FILE || &file_number;

TABLE FILE &table_name
PRINT .....
"

Is there a way that we can do this? Or we have to create a separate master for each excel file. They will all contain the same columns with the same format.

Thank you in advance for your help!

Best regards,

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


WebFocus V8.2.03M
June 07, 2019, 09:19 AM
FP Mod Chuck
Guilaine

You can definately do this with a parameter in the master file. Here is an example of one.


FILENAME=JOIN_DEMO_CUSTOMER, SUFFIX=DIREXCEL,
DATASET=baseapp/&&DATASET1, $
VARIABLE NAME=&&DATASET1, $
SEGMENT=JOIN_DEMO_CUSTOMER, SEGTYPE=S0, $
FIELDNAME=ID_CUSTOMER, ALIAS='ID Customer', USAGE=I9, ACTUAL=A11V,
MISSING=ON,
TITLE='ID Customer', $
FIELDNAME=EMAIL___ADDRESS, ALIAS='Email Address', USAGE=A34V, ACTUAL=A34V,
MISSING=ON,
TITLE='Email Address', $
FIELDNAME=FIRST_NAME, ALIAS='First Name', USAGE=A9V, ACTUAL=A9V,
MISSING=ON,
TITLE='First Name', $
FIELDNAME=FULL_NAME, ALIAS='Full Name', USAGE=A21V, ACTUAL=A21V,
MISSING=ON,
TITLE='Full Name', $
FIELDNAME=LAST_NAME, ALIAS='Last Name', USAGE=A12V, ACTUAL=A12V,
MISSING=ON,
TITLE='Last Name', $
FIELDNAME=GENDER, ALIAS=Gender, USAGE=A1V, ACTUAL=A1V,
MISSING=ON,
TITLE='Gender', $
FIELDNAME=CUSTOMER_ADDRESS__LINE_1, ALIAS='Customer Address Line 1', USAGE=A46V, ACTUAL=A46V,
MISSING=ON,
TITLE='Customer Address Line 1',
GEOGRAPHIC_ROLE=ADDRESS_LINE, $
FIELDNAME=CUSTOMER_CITY, ALIAS='Customer City', USAGE=A20V, ACTUAL=A20V,
MISSING=ON,
TITLE='Customer City',
GEOGRAPHIC_ROLE=CITY, $
FIELDNAME=CUSTOMER_STATE____PROVINCE, ALIAS='Customer State Province', USAGE=A20V, ACTUAL=A20V,
MISSING=ON,
TITLE='Customer State Province',
GEOGRAPHIC_ROLE=STATE, $
FIELDNAME=CUSTOMER_POSTAL___CODE, ALIAS='Customer Postal Code', USAGE=A8V, ACTUAL=A8V,
MISSING=ON,
TITLE='Customer Postal Code',
GEOGRAPHIC_ROLE=POSTAL-CODE, $
FIELDNAME=CUSTOMER_COUNTRY, ALIAS='Customer Country', USAGE=A14V, ACTUAL=A14V,
MISSING=ON,
TITLE='Customer Country',
GEOGRAPHIC_ROLE=COUNTRY, $


Then in the reportcaster job set the value of DATASET1 to the appropriate Excel file.

Your TABLE FILE value will always be the same master file.


Thank you for using Focal Point!

Chuck Wolff - Focal Point Moderator
WebFOCUS 7x and 8x, Windows, Linux All output Formats
June 11, 2019, 03:51 AM
Guilaine
Hello,
I try with this code, but I have a error message .

In master :
FILENAME=REF_MAKE_PGI, SUFFIX=DIREXCEL,
DATASET='1w34_reporting_steloi/&&DATASET1', BV_NAMESPACE=OFF, $
VARIABLE NAME=&&DATASET1, $
SEGMENT=REF_MAKE_PGI, SEGTYPE=S0, $
FIELDNAME=LISTE_ARTICLE_PGI, ALIAS=Liste_article_PGI, USAGE=A18, ACTUAL=A18,
MISSING=ON,
TITLE='Liste_article_PGI', $
FOLDER=DIM_REF_MAKE_PGI, PARENT=.,
DV_ROLE=DIMENSION,
DESCRIPTION='Dimensions', $
FIELDNAME=LISTE_ARTICLE_PGI, BELONGS_TO_SEGMENT=REF_MAKE_PGI, $

In schedule in task/parameter :
(Name)DATASET1=(Value)'REF_MAKE_PGI00.xlsx'

when I run the schedule report :
error message :
Schedule ID: Sdf3e863dscd55s4823s8577sc406cd0937d0, Job Description: BOM REF MAKE PGIV2 , Schedule Full Path: IBFS:/WFC/Repository/hswltgqi/std_reports/requatesgo04/BOM_REF_MAKE_PGIV2.sch
Completed with errors/warnings
(FOC295) A VALUE IS MISSING FOR: &&DATASET1 Task error: IBFSException 6000: Error executing procedure BOM_REF_MAKE_PGIV2.fex No report to distribute.

Thank you in advance


WebFocus V8.2.03M
June 11, 2019, 07:38 AM
MartinY
quote:
Then in the reportcaster job set the value of DATASET1 to the appropriate Excel file.

You need to set the variable as stated by Chuck
In your schedule go to Tasks then within a task under Parameters tab add &DATASET1 and its value.
Since the variable as been defined as a Global variable in the master file (with two ampersand : &&) you need to enter your variable name as : &DATASET1.
The second ampersand is added by the scheduler.


WF versions : Prod 8.2.0.1M gen 240, Dev 8.2.04 gen 48, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
June 12, 2019, 02:34 AM
Guilaine
Hello,

Thank you for your help. I could not make it work by creating the parameter with the "&" in the schedule like you proposed. It kept saying the following error message:
(FOC 295) A VALUE IS MISSING FOR: &DATASET1

I had to create a normal parameter in the schedule and use a set in the code (fex file):
-SET &&DATASET1 = &SCH_PARAM;

And then I gave the value REF_MAKE_PGI.xlsx to "SCH_PARAM" in the schedule.
Not sure if it is the best way, but it works.


WebFocus V8.2.03M
June 12, 2019, 07:44 AM
MartinY
Honestly, I never define global variable in a schedule (two ampersand).
Normally GV are defined in a profile as per example since they are set for the whole system not only for a schedule/fex.

But since this is global variable that is defined in the .mas, the way you made it, is ok

Please update your first post then add [SOLVED] at the beginning of the subject


WF versions : Prod 8.2.0.1M gen 240, Dev 8.2.04 gen 48, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007