Vensim ODBC scenario selection via run name

Use this forum to post Vensim related questions.
Post Reply
pav80
Member
Posts: 32
Joined: Fri Jan 24, 2014 11:09 am
Vensim version: DSS

Vensim ODBC scenario selection via run name

Post by pav80 »

Hi,

Saw on https://www.vensim.com/documentation/va ... enario.htm that one can refer to the name of the current Vensim simulation run by using the character (!).

Therefore if one has the below ODBC query, can one actually send the scenario name in the form of the character (!) to the select statement?

More specifically wondering if this part of the SQL code "AND

Code: Select all

 IN ('STEPS')" can be changed to use ! and automatically get the name of the scenario from the run name.

Tried it but doesn't seem to work, so wanted to see if others had experience with this?

:DATA
	:VARNAME=[Code FLOW]
		:SUB=[Code PRODUCT]
		:SUB=[Code REGION]
		:TIME=[YEAR]
		:VALUE=[VALUE] 
		:SELECT DW
		WHERE [Code FLOW] IN ('BASEDECLINE')\
		AND [Code UNIT] IN ('DECIMAL')\
		AND [Code PRODUCT] IN ('GAS')\
		AND [Code CATEGORY] IN ('ENERGY')\
		AND [Code PUBLICATION] IN ('2020ED')\
		AND [Code SCENARIO] IN ('BASE')

Thanks, Pawel
Administrator
Super Administrator
Posts: 4573
Joined: Wed Mar 05, 2003 3:10 am

Re: Vensim ODBC scenario selection via run name

Post by Administrator »

Can you upload the database/model/VDI files that you are using?
Advice to posters seeking help (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391

Units are important!
http://www.bbc.co.uk/news/magazine-27509559
tomfid
Administrator
Posts: 3804
Joined: Wed May 24, 2006 4:54 am

Re: Vensim ODBC scenario selection via run name

Post by tomfid »

My suspicion is that you can use ! in a simple statement, as in the help example, but not in a complex select statement. If you use :FIELD statements instead of your WHERE / AND select, it should work.
Post Reply