Global variables in VDI files
Posted: Sat Nov 20, 2021 7:36 am
Hello,
Below is an example of some VDI code.
Wondering if it is possible to declare in the VDI file at the start a global variable that you can then call in the SQL statements in the VDI file, so as to make the VDI code easier to update with such global variables.
In the below case for example can we have a global variable called 'myScenario' and therefore you could replace statements like
Below is an example of some VDI code.
Wondering if it is possible to declare in the VDI file at the start a global variable that you can then call in the SQL statements in the VDI file, so as to make the VDI code easier to update with such global variables.
In the below case for example can we have a global variable called 'myScenario' and therefore you could replace statements like
Code: Select all
IN ('EO2022')\
by
[Code PUBLICATION] IN (myScenario)\
if at the top of the VDI file mySCenario is defined as 'EO2022' ?
Thanks
>>>>
:CONNECT DRIVER=SQL Server;SERVER=;Trusted_Connection=Yes;APP=Vensim family of products;
:DATA
:VARNAME='VDFX wem AGGREGATE REGION'
:SUB=[Code FLOW]
:SUB=[Code PRODUCT]
:SUB=[Code REGION]
:SUB=[Code CATEGORY]
:SUB=[Code UNIT]
:TIME=[YEAR]
:VALUE=[VALUE]
:SELECT DW.rep.V_DIVISION_INPUT_OG\
WHERE( [Code PUBLICATION] IN ('EO2022')\
AND [Code SCENARIO] IN ('STEPS')\
AND [Code FLOW] IN ('CONV')\
AND [YEAR] BETWEEN '1970' AND '2050')\
OR( [Code PUBLICATION] IN ('EO2022')\
AND [Code SCENARIO] IN ('STEPS')\
AND [Code FLOW] IN ('TOTTPEDADJ1')\
AND [YEAR] BETWEEN '2022' AND '2050')
:DATA
:VARNAME='VDFX wem AGGREGATE COUNTRY'
:SUB=[Code FLOW]
:SUB=[Code PRODUCT]
:SUB=[Code REGION]
:SUB=[Code CATEGORY]
:SUB=[Code UNIT]
:TIME=[YEAR]
:VALUE=[VALUE]
:SELECT DW.rep.V_DIVISION_INPUT_OG\
WHERE( [Code PUBLICATION] IN ('EO2022')\
AND [Code SCENARIO] IN ('STEPS')\
AND [Code FLOW] IN ('GDPPP')\
AND [YEAR] BETWEEN '1970' AND '2050')\
OR( [Code PUBLICATION] IN ('EO2022')\
AND [Code SCENARIO] IN ('STEPS')\
AND [Code FLOW] IN ('POPULATION')\
AND [YEAR] BETWEEN '1970' AND '2050')