cancel
Showing results for 
Search instead for 
Did you mean: 

model parameters

0 Kudos
224

Hi Experts

I created a model parameter for eg on company code (CC_1) parameter.

in AA, how to read that parameter value and set it to script variable ?

Thanks

M

View Entire Topic
N1kh1l
Active Contributor

malya_7

I am not sure what you mean by model parameter, if you mean model level variable then you can use below API

after adding a table (just to bind the datasource)

var ds =Table_1.getDataSource();
var sel =ds.getVariableValues("VariableID");
console.log(sel);

Variable id is what you define at model level

My model variable value selection was 1

Hope this helps !!

Please upvote/accept if this helps

Nikhil

0 Kudos

Thanks Nikhil,

you are right its model variable.

with above code I can see my variable value.

But my table in a story is showing all the company codes it is not considering model variable value and filter automatically. Do I need to do anything to bind table with model variable?

N1kh1l
Active Contributor
0 Kudos

malya_7

Your question was how to read the variable value, it never mentioned about filtering any dimension. Once you have the value of the variable in a script variable or normal just used that to filter using the below API

Table.getDataSource().removeDimensionFilter("DimensionId"); 
Table.getDataSource().setDimensionFilter("DimensionId", VariableValue); //replace DimensionId with your dimension

VariableValue should be value read from variable. Also you might need to specify fully qualified name [DImensionId].[HierId].[MemberName]

Nikhil