Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to pre-select n records in a listbox?

Hi Friends,

          I wanted to show last 12 months data when QV application is loaded. I think if the last 12 yearMonth can be selected when application is loaded, it will solve my problem. So my question is how I can pre-select the last 12 or n items in the list box. My YearMonth listbox like below. Can this be done? Thanks

201201
201202
201203
201204
201205
201206
201207
201208
201209
201210
201211
201212
201301
201302
201303
201304
201305
201306
201307
201308
201309
201310
201311
201312
201401
1 Solution

Accepted Solutions
Nicole-Smith

You said in your original post, "I think if the last 12 yearMonth can be selected when application is loaded."  I took that as meaning you wanted them selected when the application was reloaded.  If you meant you want them selected when the application is opened, you need to use the following instead:

Settings > Document Properties > Triggers > On Open > Add Actions > Selection > Select in Field

Field:

YearMonth

Search String:

='>='&max(YearMonth,12)

Example file also attached.

View solution in original post

8 Replies
Nicole-Smith

Settings > Document Properties > Triggers > On Post Reload > Add Actions > Selection > Select in Field

Field:

YearMonth

Search String:

='>='&max(YearMonth,12)

Example file also attached.

Not applicable
Author

Thank you for you quick response. Your example works just fine, but I cannot get it done by following your instruction. I will continue working on it and let you know.

Not applicable
Author

Here is the sample I created using your data, but it did not work. Please find my file in attachment. Something is missing from my side.

jaimeaguilar
Partner - Specialist II
Partner - Specialist II

The example Nicole showed works. However you have to keep in mind that because the trigger is applied as an OnPostReload, preselections will only occur after you Reload the document at least once. You can also set the trigger at sheet level with a onActivate/onleave sheet event (Settings > Sheet properties > triggers, so you don't have to wait until reload to see the selections take effect,

regards

Nicole-Smith

You said in your original post, "I think if the last 12 yearMonth can be selected when application is loaded."  I took that as meaning you wanted them selected when the application was reloaded.  If you meant you want them selected when the application is opened, you need to use the following instead:

Settings > Document Properties > Triggers > On Open > Add Actions > Selection > Select in Field

Field:

YearMonth

Search String:

='>='&max(YearMonth,12)

Example file also attached.

Not applicable
Author

Is there any way only last 12 months data will be displayed in the chart? This solution works fine when application is first loaded. Obviously it is not an ideal solution. Do you have any ideas? Thanks

Nicole-Smith

Set analysis in your expression like the following should work for that:

{<YearMonth={'>=$(=max({1}YearMonth,12))<=$(=max({1}YearMonth))'}>}

So your expression would look like:

sum({<YearMonth={'>=$(=max({1}YearMonth,12))<=$(=max({1}YearMonth))'}>}Value)

Example file is attached.

Not applicable
Author

Qlikview is so powerful and you are the genius. Thanks