Hi,
When I use Vensim_Get_Data, I find that I must put the subscript element in the variable name, I can't put the actual name of the subscript range and get all the output. Any advice on how to simplify this process and just use the subscript name to get data on all the elements?
Many thanks,
Sarah
What I want to do:
tpoints = vensim_get_data("test.vdf", "Industry Volumes[Channel]", "time", qval(1), tval(1), 100)
What I must do:
tpoints = vensim_get_data("test.vdf", "Industry Volumes[supermarket]", "time", qval(1), tval(1), 100)
tpoints = vensim_get_data("test.vdf", "Industry Volumes[conveniencestore]", "time", qval(1), tval(1), 100)
tpoints = vensim_get_data("test.vdf", "Industry Volumes[gasstation]", "time", qval(1), tval(1), 100)
Vensim Get Data with subscript
-
- Super Administrator
- Posts: 4590
- Joined: Wed Mar 05, 2003 3:10 am
Re: Vensim Get Data with subscript
You can't get the data all at once.
But you can retrieve the list of subscript elements, and then concatenate that onto the parameter name and loop that way.
Eg,
But you can retrieve the list of subscript elements, and then concatenate that onto the parameter name and loop that way.
Eg,
Code: Select all
nCharsRequired = vensim_get_varattrib("Channel",8,0,0) ;
strBuffer = Space(nCharsRequired)
nCharsRequired = vensim_get_varattrib("Channel",8,strBuffer ,nCharsRequired ) ;
Do
strSubscriptElement = space(50)
nLen = vensim_get_substring(strBuffer,y,strSubscriptElement,50) ;
If (nLen = 0) Then Exit Do
tpoints = vensim_get_data("test.vdf", "Industry Volumes[" & strSubscriptElement & "]", "time", qval(1), tval(1), 100)
y = y + length
x = x + 1
Loop
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
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Units are important!
http://www.bbc.co.uk/news/magazine-27509559