Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi experts,
I han a sub in the Script área, this sub can I call in a Expression?
Best regards.
Hi,
you can create variables with parameters, so you can have something like "user defined functions" within charts.
An easy example would be something like this:
Let's say your formula is Sum({$<Product={'$1'}>} Sales). In this case the '$1' part, will be calculated until there is some interaction with an external event (like a user selecting one or more products from a listbox). It is important to note that your "dynamic" variable cannot be precalculated, otherwise it won't work correctly. This means that when you create your variable you should not include a = at the beginning of your expression.
Then when calling this variable you need to use the following syntax: $(VariableName(Parameter1, parameter2, parameterN)). Just like in a sub you can define 1 or any number of parameters.
This QlikView Feature allows you to reuse a single variable for many different scenarios and to make your variables more dynamic,
regards
no, you can't execute backend function from frontend (macro excepted)
well in that case,
could I set a variable for axample selecting a value from list box?
best regards
Hi,
you can create variables with parameters, so you can have something like "user defined functions" within charts.
An easy example would be something like this:
Let's say your formula is Sum({$<Product={'$1'}>} Sales). In this case the '$1' part, will be calculated until there is some interaction with an external event (like a user selecting one or more products from a listbox). It is important to note that your "dynamic" variable cannot be precalculated, otherwise it won't work correctly. This means that when you create your variable you should not include a = at the beginning of your expression.
Then when calling this variable you need to use the following syntax: $(VariableName(Parameter1, parameter2, parameterN)). Just like in a sub you can define 1 or any number of parameters.
This QlikView Feature allows you to reuse a single variable for many different scenarios and to make your variables more dynamic,
regards
for your example if you want the user to calculate something depending on a selection, regarding my previous post, the variable call would be like this:
$(VariableName( $(=Concat(distinct Product, chr(44) ))
I used this concat function in order to allow users to calculate for example the sum of sales of 1 or any product that is selected in a listbox.
you can also store the $(=Concat(distinct Product, chr(44)) in another variable so it can be easier for end-users to reuse expressions across different variables,
regards
Thanks a lot Jaime.
Jaime,
I need set that you sed since the setings ->Variables Panel?
best regards.
Yes, the easiest way of creating variables is going to settings > variable overview (Panel de variables)
regards
ok,
but a mean the sentence of your example '$(Variablename($=Concat(Distinct Product,chr(44)))'
I can set in the setings or directly in a Expression?
best regards.
For this example the expression has to be:
sum({$<Product={'$1'}>}Sales)
So let's say this expression is inside a variable called v1
then when you call it in a chart you have to use this syntax:
$(v1( $(=Concat(Distinct Product,chr(44))) )) The text in bold is the parameter of your variable.
the $(=Concat(Distinct Product,chr(44))) can be anything. When the variable is calculated the '$1' in your original expression will be substituted with whatever you put inside the parameter of the variable.