Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Select in Field - Variable in search string

HI all,

i have to select some values in a field while a variable changes its value, but the values that i have to select depend on the value of that variable.

so, if the variable (year) takes a value i have to select in field (month_name) all the months of the selected year and the last 3 of the $(year)-1.

i tried to set the search string like this :

='Jan '&$(year)&'|'&... ...&'Dec '&$(year) // all months of the selected year

&'| Oct '&($(year)-1)&'|Nov '&($(year)-1)&'|Dec '&($(year)-1) //last three months of the previous year

but does not work, nothing is selected...

any ideas??

1 Solution

Accepted Solutions
Not applicable
Author

Thank you all for the answers!!

I solved the problem by setting the search string as follows:

='(Jan?'&$(V_year_selected)&'|' &

'Feb?'&$(V_year_selected)&'|' &

'Mar?'&$(V_year_selected)&'|' &

'Apr?'&$(V_year_selected)&'|' &

'May?'&$(V_year_selected)&'|' &

'Jun?'&$(V_year_selected)&'|' &

'Jul?'&$(V_year_selected)&'|' &

'Aug?'&$(V_year_selected)&'|' &

'Sep?'&$(V_year_selected)&'|' &

'Oct?'&$(V_year_selected)&'|' &

'Nov?'&$(V_year_selected)&'|' &

'Dec?'&$(V_year_selected)&'|' &

'Oct?'&($(V_year_selected)-1)&'|' &

'Nov?'&($(V_year_selected)-1)&'|' &

'Dec?'&($(V_year_selected)-1)&')'

i have used a toggle select on the month field

View solution in original post

2 Replies
Anonymous
Not applicable
Author

Looks like you're using toggle select, and the field format is 'Jan 2013'

The only missing part is the () around your expression.  It would be:

='(Jan ' ... &')'

Regards,

Michael

Not applicable
Author

Thank you all for the answers!!

I solved the problem by setting the search string as follows:

='(Jan?'&$(V_year_selected)&'|' &

'Feb?'&$(V_year_selected)&'|' &

'Mar?'&$(V_year_selected)&'|' &

'Apr?'&$(V_year_selected)&'|' &

'May?'&$(V_year_selected)&'|' &

'Jun?'&$(V_year_selected)&'|' &

'Jul?'&$(V_year_selected)&'|' &

'Aug?'&$(V_year_selected)&'|' &

'Sep?'&$(V_year_selected)&'|' &

'Oct?'&$(V_year_selected)&'|' &

'Nov?'&$(V_year_selected)&'|' &

'Dec?'&$(V_year_selected)&'|' &

'Oct?'&($(V_year_selected)-1)&'|' &

'Nov?'&($(V_year_selected)-1)&'|' &

'Dec?'&($(V_year_selected)-1)&')'

i have used a toggle select on the month field