Thanks a lot. I guess I wasn't very clear. I'm trying to do this in sheet objects instead in script. What I want to do is set
factors, vFactor1-3, using Input objects, and assign them to loaded data in sheet objects for further calculation.
Name Category Price FactorSelect
a 1 120 1.2
b 1 110 1.2
c 2 200 1.3
d 3 130 2.4
What I'm trying to do is effectively, below
= sum ( [Price] * [FactorSelect] )
but because this FactorSelect field doesn't exist and should be set dynamically (after script has run by the user inupt)
I am attempting to indirectly reference vFactor1-3 depending on the value in the Category field.
= sum ( [Price] * ['vFactor' & $(Category)] )
Is possible to do in QlikView?
Hi Namhi, just to comment that Felip code is using the variables to assign field values, but will need a reload of the data to reflect changes in variable values.
If you need to reflect changes without a reload and the values should change based on category then you have to check Category outside outside the $-expansion, ie:
Pick(Category, $(vFactor1), $(vFactor2), $(vFactor3))