Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
msmichael
Creator
Creator

concat does not work in my variable

Hi experts,

I have two fields - myyear and mymonth. There's a list for myyear for users to choose a year.

I created two variables, one is vSelectedYear, definition is =GetFieldSelections([myyear]), this is used to record the year that is currently selected by user.

The other variable is called "vYearPlugMonths", the purpose of the variable is to get the list of months that are available in the selected year, plus the unselected years..

For example, I have data list below,

myyearmymonth
20161
20162
20165
201710
201711
201712
20181
20182

 

so when user selects 2016, the variable should be: 2017,2018,1,2,5  (because 1, 2, 5 are available months in 2016)

when user selects 2017, the variable should be: 2016,2018,10,11,12 (because 10,11,12 are available months in 2017)

and so on.

I used this definition: =Concat({<myyear-={'$(vSelectedYear'}>} [myyear]) & Concat({1 <myyear={'$(vSelectedYear)'}>} chr(39) & [mymonth] & chr(39), ',')

but it did not work.

Could anyone please shed some light? The qvw file is attached..

Thanks,

Michael

 

 

 

 

 

Labels (1)
2 Solutions

Accepted Solutions
dplr-rn
Partner - Master III
Partner - Master III

change your variable to below. red is pieces i added

=Concat(DISTINCT{1<myyear-={'$(vSelectedYear)'}>} [myyear]) & Concat({1 <myyear={'$(vSelectedYear)'}>} chr(39) & [mymonth] & chr(39), ',')

 

Also the variable name in the text box was not right

View solution in original post

dplr-rn
Partner - Master III
Partner - Master III

remove the = at start of the variable definition.

Mark as answered and close the thread please

View solution in original post

3 Replies
dplr-rn
Partner - Master III
Partner - Master III

change your variable to below. red is pieces i added

=Concat(DISTINCT{1<myyear-={'$(vSelectedYear)'}>} [myyear]) & Concat({1 <myyear={'$(vSelectedYear)'}>} chr(39) & [mymonth] & chr(39), ',')

 

Also the variable name in the text box was not right

msmichael
Creator
Creator
Author

Hi Dilipranjith,

 

sorry for the typos... I tried your definition and corrected the variable name, now I receive error:

Error: Garbage after expression: "10"

new qvw file attached..

 

Thanks,

Micahel

dplr-rn
Partner - Master III
Partner - Master III

remove the = at start of the variable definition.

Mark as answered and close the thread please