Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Use variable to set a max value for a field

Hi All,

I am trying to use a variable to control the value of a field and in return filter out the data set based on that. I am giving user an input box where he can enter a max value and that should filter the entire charts on the report.

I am using an input box and I have to set a trigger that can set the maximum value of the field to the value input by the user. Can anyone please help me achieving this or recommend any other possible solution?

Eg: my field name is Rank.

Capture.PNG

So if a user enters a 15 into the input box, the field rank should select all the records from 1 to 15.

Thanks for your help.

1 Solution

Accepted Solutions
Sokkorn
Master
Master

Hi,

Let add variable event trigger by goto Setting ==> Document Properties ==> Triggers ==> Variable Event Triggers ==> OnChange ==> Add Action(s) ==> <Select in Field>

     1. Field box put Ranks

     2. Search String box put ='(' & Concat(Aggr(Only({$<Ranks = {"<=$(=vMax)"}>} Ranks),Ranks),'|') & ')'

Variable Trigger.png

See sample file also

Let me know after you test

Regards,

Sokkorn

View solution in original post

7 Replies
Sokkorn
Master
Master

Hi,

Let do this:

     1. Create variable for input box called vMax

     2. Create list box with expression =Aggr(Only({$<Rank = {"<=$(=vMax)"}>} Rank),Rank)

See the sample attached file

Hope this help.

Regards,

Sokkorn

Not applicable
Author

Hi Sokkorn,

Thanks for your reply. What your above app is doing is selecting the values for the list box but not filtering out the data as a whole. I am looking for something like when a user enters a value into the input box, all the values which are less than the input value should get selected and all the other objects on the report should filter the data based on that. Does that makes sense?

Thanks again for your help.

Not applicable
Author

Hi,

i tride with sample data in my attachment.. the input box variable you have to call in all your reports else it won't filter the data according to my knowledge..

//Chandra

Not applicable
Author

Hi Chandra,

I am not sure, but it looks like your app is not working. My requirement is - I have a field which has numeric values.

1

2

3

4

5

6

7

8

I want to create an input box where a user would enter a maximum value. Example - if a user enters 6, all the values from 1 to 6 will be selected. So like when we select mutiple values in a list box, it greens out and select related data in other charts and graphs in the dashboard. In a similar way, as soon as a user would hit enter it will select all the 6 values automatically.

Thanks for your reply.

Sokkorn
Master
Master

Hi,

Let add variable event trigger by goto Setting ==> Document Properties ==> Triggers ==> Variable Event Triggers ==> OnChange ==> Add Action(s) ==> <Select in Field>

     1. Field box put Ranks

     2. Search String box put ='(' & Concat(Aggr(Only({$<Ranks = {"<=$(=vMax)"}>} Ranks),Ranks),'|') & ')'

Variable Trigger.png

See sample file also

Let me know after you test

Regards,

Sokkorn

jzimolong
Creator II
Creator II

I know this is very old, but can the Search String formula above be expanded to have a lower boundary as well, from a user input variable?

Essentially doing a < vMax AND > vMin

How can I weave that into the formula?

jzimolong
Creator II
Creator II

Please disregard my previous question, I was able to figure it out.  Great technique.