Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

msmichael
Contributor

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
Partner
Partner

Re: concat does not work in my variable

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

Partner
Partner

Re: concat does not work in my variable

remove the = at start of the variable definition.

Mark as answered and close the thread please
3 Replies
Partner
Partner

Re: concat does not work in my variable

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
Contributor

Re: concat does not work in my variable

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

Partner
Partner

Re: concat does not work in my variable

remove the = at start of the variable definition.

Mark as answered and close the thread please