Discussion Board for collaboration on QlikView Scripting.
I have an input field initialized with zero.
I want to set a value on it based on a expression of a chart, and only then the user can adjust it.
I need that because the inicial calculation of this field is based on a sum of selected items.
This what I have:
My inputfield is "Allocated". In this example, I selected the Months 1 and 2.
The initial expression for it is:
If(Sum(Stock) >= Sum(Quantity), Sum(Quantity), Sum(Stock))
For the Product P1, the "initial value" of the input field "Allocated" is 7 (because the Sum(Quantity) is based on Months 1 and 2).
If I change the selection of the Months, the initial value of the input field "Allocated" should change.
How can I achieve this ?
I don't really understand the requirement clearly, would you be able to share the output you are expecting based on few different selections?
Let's consider that the value of Sum(Stock) of Product P1 is 8 (Ignore the first table).
If I select the Months 1 and 2, the Sum(Quantity) of product P1 is 7 (see second table).
So, following the expression for the initial value of "Allocated" of Product P1, its value should be 7.
If I select Months 1, 2 an 3, the Sum(Quantity) of Product P1 is 9 (3 + 4 + 2).
With that, the initial value of "Allocated" should be 8 (according to the formula expression).
I think your formula is doing that. Look at P4 Product
Picking stock, since Sum(Stock) is lower when no selection is made
Picking Quanitity, since Sum(Stock) is higher now based on Month 1 and 2 selected
Isn't that what you want?
Yes, but I need that inside an input field.
My idea (actually the client's idea) is the following:
The user select a couple of months, then we will have an "initial" value for "Allocated" (based on the expression).
Then, he can adjust this value manually.
As the expression is based on selections, I cannot set an initial value for this field using the load scripts.