Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Multiple Selection Trigger based on variables

Hi,

I'm currently on my first QV steps, so I really appreciate any help.


I want to automatically select a range of month-year dates when clicking on a text box with an action set. The selection has to be last12 months from 2 months before now. For instance, if we are now 03-2014 the selection should be from 01-2013 to 12-2013. I set the variables for the range bounds:

v1:     Date(MonthName(Date(MonthStart(AddMonths(Max({1} Datefield),-2))-1)), 'MM-YYYY')

v2:     Date(MonthName(Date(MonthStart(AddMonths(Max({1} Datefield),-13))-1)), 'MM-YYYY')


If I add a Field Selection action in the text box:

Field ->     DateField

String ->    =$(v1)

it works fine, so v1 and v2 are ok.


I couldn't make it work when I tried to select the whole range from v1 to v2 (month-year). I found some solutions based on concat(.....|....), but the inside text was always strings, not variables.


Thanks.



8 Replies
MK_QSL
MVP
MVP

It would be better if you have enclosed a sample file or sample apps...

DavidFoster1
Specialist
Specialist

The approach I would use for this is:

1) Have a calendar that has an 'ISMonths-2-14' flag field (i.e. 1 or 0)

2) Create a button that has multiple actions

     a) Select In Field  'ISMonths-2-14'

     b) Select Possible [your months field]

     c) Clear field 'ISMonths-2-14'

This would give the illusion to the end user of QlikView directly selecting the 12 months you want.

Not applicable
Author

Hi,

Today ----> 03-2014

Create variables

Ex:

vBackDate = Date(AddMonths(Monthstart(Today()),-2),'MM-YYYY')  ----> 01-2014

vFutureDate = Date(YearEnd(Today()),'MM-YYYY')   ----> 12-2014

Button/AnyAction :

Field ---> Your Date Field (MM-YYYY)

SearchString : ='>='&vBackDate&'<='&vFutureDate


Not applicable
Author

Manish,

OK, I attached a file.

Thanks

Not applicable
Author

Use like this

 

='>='&$(vSelectTAM2)&'<='&$(vSelectTAM1)

Not applicable
Author

David,

I finally chose your option. Defined in script and simplier to set.

Thanks

Not applicable
Author

I was trying in this way, but I finally chose the other solution posted. Also thank you anyway.

DavidFoster1
Specialist
Specialist

Simpler is usually better