Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
MauriAuat
Contributor
Contributor

Passage as parameter of set of values ​​separated by comma

Hi,

This is my first partipation in the Forum. I need some help with my app.

I have a master measure to count dengue cases from December 2022 to April 2023. The problem is that to filter the months I use a variable that contains the aggregation with an analysis set that filters the months, and I call it as a function with the year as a parameter (to be able to apply it to 2023/24) but with this I end up taking the months of the year that passed as a parameter, that is, if it is 2023 it takes: January, February, March, April and December, instead of taking : December (2022), January, February, March and April, that is, December is also 2023. 

 

I tried to solve it by making a condition in my master measure so that when the month is December, I pass the previous year and the month of December as parameters, and if the month is any of the remaining months, I pass the current year and those months. I think it can work but when I spend several months as the 2nd parameter, it cuts off at the first comma it finds.

I give you a bit of the code of how I have proposed it. Notice for the abbreviations and names of variables, measures and dimensions are in Spanish

My master measure

if(Mes='Dic',${vCantCasos(2022,'Dic')},${vCantCasos(2023,${vSetMesesSinDi})})

The error

MauriAuat_3-1715288489691.png

 

First simple solution but didnt work by the single quotes:
 
='Ene,Feb, Mar, Abr' (this would be a variable)
 
Second solution that almost work but I have the issue with the comma:
 
MauriAuat_1-1715289340920.png

 

 Finally, I share this other alternative because I need for the set analysis for the month values ​​to be passed as strings with single quotes, but from the beginning it did not work (I also share the error it gives me).

 

MauriAuat_3-1715289570713.png

 

I don't know how to move forward and I've already looked for the solution but I can't find anything that is useful to me. I hope that with what I shared you can understand everything and someone can give me a hand. From already thank you very much

 
 
 
 
Labels (1)
1 Solution

Accepted Solutions
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

This is a known issue in variables with parameters. There is no escape syntax that allows a comma to be passed as part of a parameter value. The only workaround I've ever found is to use a proxy character like | and then replace with comma in the expression. Something like:

SET vVar = '{<' & Replace('$1', '|', ',') & '>}';

$(vVar(''abc''|''def''))

result: {<'abc','def'>}

-Rob
http://www.easyqlik.com
http://masterssummit.com
http://qlikviewcookbook.com

View solution in original post

2 Replies
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

This is a known issue in variables with parameters. There is no escape syntax that allows a comma to be passed as part of a parameter value. The only workaround I've ever found is to use a proxy character like | and then replace with comma in the expression. Something like:

SET vVar = '{<' & Replace('$1', '|', ',') & '>}';

$(vVar(''abc''|''def''))

result: {<'abc','def'>}

-Rob
http://www.easyqlik.com
http://masterssummit.com
http://qlikviewcookbook.com

MauriAuat
Contributor
Contributor
Author

Oh I see, thank you @rwunderlich ! I will try tomorrow when I continue working.