Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
jcs_2015
Contributor III
Contributor III

Creating a Concatenated String of Values for a Trigger (Select in Field)

I'm trying to generate a list of Values for a trigger (via a button) to select a rolling 12 month time frame.  I've built the following and appear to get the proper results when viewed in a Text Box BUT I just can't seem to get the trigger to make the sections though

=Concat($(vCurrentMth) &
'|' & $(vCurrentMth-1) &
'|' & $(vCurrentMth-2) &
'|' & $(vCurrentMth-3) &
'|' & $(vCurrentMth-4) &
'|' & $(vCurrentMth-5) &
'|' & $(vCurrentMth-6) &
'|' & $(vCurrentMth-7) &
'|' & $(vCurrentMth-8) &
'|' & $(vCurrentMth-9) &
'|' & $(vCurrentMth-10) &
'|' & $(vCurrentMth-11) )

 

Output is: Apr 2019|Mar 2019|Feb 2019|Jan 2019|Dec 2018|Nov 2018|Oct 2018|Sep 2018|Aug 2018|Jul 2018|Jun 2018|May 2018

Thoughts on why the Trigger won't make selections?  Any thoughts on a more elegant solution as well (front end only though)?

Thanks

Jim

 

Labels (2)
1 Solution

Accepted Solutions
sunny_talwar

Try this

='("' & Concat($(vCurrentMth) &
'"|"' & $(vCurrentMth-1) &
'"|"' & $(vCurrentMth-2) &
'"|"' & $(vCurrentMth-3) &
'"|"' & $(vCurrentMth-4) &
'"|"' & $(vCurrentMth-5) &
'"|"' & $(vCurrentMth-6) &
'"|"' & $(vCurrentMth-7) &
'"|"' & $(vCurrentMth-8) &
'"|"' & $(vCurrentMth-9) &
'"|"' & $(vCurrentMth-10) &
'"|"' & $(vCurrentMth-11)) & '")'

 

to get this

("Apr 2019"|"Mar 2019"|"Feb 2019"|"Jan 2019"|"Dec 2018"|"Nov 2018"|"Oct 2018"|"Sep 2018"|"Aug 2018"|"Jul 2018"|"Jun 2018"|"May 2018")

 

or you can explore the option of using >=MonthYear<=MonthYear if your field is a date field with dual value.

View solution in original post

4 Replies
sunny_talwar

Try this

='("' & Concat($(vCurrentMth) &
'"|"' & $(vCurrentMth-1) &
'"|"' & $(vCurrentMth-2) &
'"|"' & $(vCurrentMth-3) &
'"|"' & $(vCurrentMth-4) &
'"|"' & $(vCurrentMth-5) &
'"|"' & $(vCurrentMth-6) &
'"|"' & $(vCurrentMth-7) &
'"|"' & $(vCurrentMth-8) &
'"|"' & $(vCurrentMth-9) &
'"|"' & $(vCurrentMth-10) &
'"|"' & $(vCurrentMth-11)) & '")'

 

to get this

("Apr 2019"|"Mar 2019"|"Feb 2019"|"Jan 2019"|"Dec 2018"|"Nov 2018"|"Oct 2018"|"Sep 2018"|"Aug 2018"|"Jul 2018"|"Jun 2018"|"May 2018")

 

or you can explore the option of using >=MonthYear<=MonthYear if your field is a date field with dual value.

jcs_2015
Contributor III
Contributor III
Author

Thanks Sunny, that works perfectly, as usual!

Can you explain, why the Concat function itself is included inside the ()?  Is that the only way Qlik will recognize of string of values like this for selections via a trigger?

sunny_talwar


@jcs_2015 wrote:

Can you explain, why the Concat function itself is included inside the ()?  


Because you need the final thing to look like this
("Apr 2019"|"Mar 2019"|"Feb 2019"|"Jan 2019"|"Dec 2018"|"Nov 2018"|"Oct 2018"|"Sep 2018"|"Aug 2018"|"Jul 2018"|"Jun 2018"|"May 2018")

This is the syntax Qlik requires for searching.


@jcs_2015 wrote:

Is that the only way Qlik will recognize of string of values like this for selections via a trigger?


Like I mentioned, if you have MonthYear as a date and time field, you can use >= <= to trigger

jcs_2015
Contributor III
Contributor III
Author

Thanks again, I'll work on the >= option too as I believe it is ultimately a cleaner solution