Get Subscript Constants from different sheets

Use this forum to post Vensim related questions.
Post Reply
lfbpmb
Junior Member
Posts: 7
Joined: Wed Jul 26, 2017 8:07 pm
Vensim version: PRO

Get Subscript Constants from different sheets

Post by lfbpmb »

Hi,
Does anyone know if it is possible to pass the subscript name as a string parameter so I can get a value for each subscript item from different sheets in Excel?
I´m looking for something like:
GET XLS CONSTANTS('DadosORCPRs.xlsx', [PRs], 'B2' )
The idea is that each value comes from a sheet with the same name of the subscript item.
Thanks
tomfid
Administrator
Posts: 3804
Joined: Wed May 24, 2006 4:54 am

Re: Get Subscript Constants from different sheets

Post by tomfid »

Using a string variable should work. Something like:

Sheet : (sheet1-sheet3)
Sheet name[sheet1] :IS: 'fred'
Sheet name[sheet2] :IS: 'bob'
Sheet name[sheet3] :IS: 'mary'
myval[sheet] = GET XLS CONSTANTS( 'filename', sheet name[sheet], 'a1' )
lfbpmb
Junior Member
Posts: 7
Joined: Wed Jul 26, 2017 8:07 pm
Vensim version: PRO

Re: Get Subscript Constants from different sheets

Post by lfbpmb »

Thanks for your answer.
I´m trying using a string variable that gets the subscripted values also from excel but I´m getting an error.
The model is attached. The string variable with the error showing is "PRsstr"
Thanks!
Attachments
OrcSubscript.mdl
(2.85 KiB) Downloaded 165 times
tomfid
Administrator
Posts: 3804
Joined: Wed May 24, 2006 4:54 am

Re: Get Subscript Constants from different sheets

Post by tomfid »

Ah ... you can't use GET XLS to retrieve strings. They have to be in the model. You can put a default value in the equation and supply overrides in a .cin file however.
tomfid
Administrator
Posts: 3804
Joined: Wed May 24, 2006 4:54 am

Re: Get Subscript Constants from different sheets

Post by tomfid »

Also, you forgot the subscript on the uses of PRsstr.

"%Orc 2341 PR"[PRs]=
GET XLS CONSTANTS('DadosORCPRs.xlsx', PRsstr[PRs], 'B2' )
lfbpmb
Junior Member
Posts: 7
Joined: Wed Jul 26, 2017 8:07 pm
Vensim version: PRO

Re: Get Subscript Constants from different sheets

Post by lfbpmb »

Thanks I lot, Ill try it.
Administrator
Super Administrator
Posts: 4573
Joined: Wed Mar 05, 2003 3:10 am

Re: Get Subscript Constants from different sheets

Post by Administrator »

Please enter your serial number in your profile. Entering incorrect information usually ends up in a ban.
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
Post Reply