Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content
Announcements
April 9th: The AI Roadmap: 6 Landmarks for AI-ready Data and Analytics: REGISTER NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
polisetti
Creator II
Creator II

Dynamic Update of field depending on Selection

I have created an inline for all the dimensions used in the dashboard. I'm showing this fields in a dropdown. Can the dropdown change dynamically based on selected dimensions i.e. dropdown should show only dimensions which are currently selected?

Ex: Inline 1

Inline 1
Product
Market
Brand

Inline 2:

Inline 2
State
Country

Now, I need a dynamic field, which will only show the values that are selected in Inline 1 and Inline 2. Is that Possible?

Thanks in Advance

1 Solution

Accepted Solutions
Sergey_Shuklin
Specialist
Specialist

Hello, Jaswanth!

It's true, the instance above just for visual part of report - User can only see which fields are selected, but can't interact with it.

If you want to make some dynamical and interactive field, please, make the followin:

1. Improve your script a little:

dim1:

Load *, dim1 as k Inline //where k is the first part of our static field which will become a dynamic field

[dim1

Product,

Market,

Brand];

dim2:

Load *, dim2 as k Inline //the same for the second part

[dim2

State,

Country];

dim_all:

Load distinct k

,round(rand()*30) as x //I've made this phony data just for checking, it can be omitted

Resident dim1;

Load distinct k

,round(rand()*30) as x //this too

Resident dim2;

//that's it - our combined field is ready, but it's still a static.

2. After reloading go to the document properties (Ctrl + Alt + D -> General -> Alternate States) and make two alternate states. I named them State A and State B;

dyn_listbox1.png

3. Create two list boxes and make them alternate selectable. (In the ListBox properties on General tab you will be able to choose the State in the top right corner). So for the first ListBox with the field dim1 it will be State A, and for the second ListBox with the field dim2 it will be State B. Now you can select in dim1 and dim2 separately;

dyn_listbox2.png

4. And here is the magic! Create another one ListBox and choose the expression in available fields. Make this expression as field:

=if(aggr(sum({[State A] + [State B]}x),k)>0,k) //I used phony generated data "x" for checkin' values which user will see on clicking dim1 or dim2 fields. There can be another verifying;

And here we go. The result will be the field which will be containing the values from selections made by dim1 or dim2 fields.

dyn_listbox3.png

And another advantage is - the values of "x" will not be affected until you make selection exact in our dynamic field (dim1 and dim2 doesn't make a sense).

dyn_listbox4.png

Hope you like it, because I feel excited about solving this task =P

View solution in original post

6 Replies
RonaldDoes
Partner - Creator III
Partner - Creator III

Hi Jaswanth,

Like the example below?

Naamloos.png

tajmohamed30
Creator III
Creator III

you can also resize the inline list box to show hide excess spaces from demo app

Sergey_Shuklin
Specialist
Specialist

Hello, Jaswanth!

If you're lookin' for result like this:

dyn_listbox.png

So you may be interested with attached file. There is a ListBox which values are combined from two separate list boxes.

Hope this is it!

ziadm
Specialist
Specialist

use the Field$ to populate an expression based on the field selection

find attached

polisetti
Creator II
Creator II
Author

Thanks Sergey,

I am looking for an option you shared. However, I noticed that we are unable to select the values in the dynamic list box. I need those values as a selectable value. Is that possible?

Sergey_Shuklin
Specialist
Specialist

Hello, Jaswanth!

It's true, the instance above just for visual part of report - User can only see which fields are selected, but can't interact with it.

If you want to make some dynamical and interactive field, please, make the followin:

1. Improve your script a little:

dim1:

Load *, dim1 as k Inline //where k is the first part of our static field which will become a dynamic field

[dim1

Product,

Market,

Brand];

dim2:

Load *, dim2 as k Inline //the same for the second part

[dim2

State,

Country];

dim_all:

Load distinct k

,round(rand()*30) as x //I've made this phony data just for checking, it can be omitted

Resident dim1;

Load distinct k

,round(rand()*30) as x //this too

Resident dim2;

//that's it - our combined field is ready, but it's still a static.

2. After reloading go to the document properties (Ctrl + Alt + D -> General -> Alternate States) and make two alternate states. I named them State A and State B;

dyn_listbox1.png

3. Create two list boxes and make them alternate selectable. (In the ListBox properties on General tab you will be able to choose the State in the top right corner). So for the first ListBox with the field dim1 it will be State A, and for the second ListBox with the field dim2 it will be State B. Now you can select in dim1 and dim2 separately;

dyn_listbox2.png

4. And here is the magic! Create another one ListBox and choose the expression in available fields. Make this expression as field:

=if(aggr(sum({[State A] + [State B]}x),k)>0,k) //I used phony generated data "x" for checkin' values which user will see on clicking dim1 or dim2 fields. There can be another verifying;

And here we go. The result will be the field which will be containing the values from selections made by dim1 or dim2 fields.

dyn_listbox3.png

And another advantage is - the values of "x" will not be affected until you make selection exact in our dynamic field (dim1 and dim2 doesn't make a sense).

dyn_listbox4.png

Hope you like it, because I feel excited about solving this task =P