Page 1 of 1
Get Subscript Constants from different sheets
Posted: Wed Jul 26, 2017 8:11 pm
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
Re: Get Subscript Constants from different sheets
Posted: Wed Jul 26, 2017 8:18 pm
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' )
Re: Get Subscript Constants from different sheets
Posted: Wed Jul 26, 2017 8:32 pm
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!
Re: Get Subscript Constants from different sheets
Posted: Wed Jul 26, 2017 8:45 pm
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.
Re: Get Subscript Constants from different sheets
Posted: Wed Jul 26, 2017 8:47 pm
by tomfid
Also, you forgot the subscript on the uses of PRsstr.
"%Orc 2341 PR"[PRs]=
GET XLS CONSTANTS('DadosORCPRs.xlsx', PRsstr[PRs], 'B2' )
Re: Get Subscript Constants from different sheets
Posted: Wed Jul 26, 2017 8:53 pm
by lfbpmb
Thanks I lot, Ill try it.
Re: Get Subscript Constants from different sheets
Posted: Wed Jul 26, 2017 9:07 pm
by Administrator
Please enter your serial number in your profile. Entering incorrect information usually ends up in a ban.