Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Variable with Parameter in Chart Expression

Hello everyone,

I have defined a variable that is designed to give me an alphabetized list of all the unique elements in a list so that I can find what number that particular element is. I pass a parameter in order to get the field I want to evaluate against. The variable works fine in a text box, but it evaluates differently in a chart.

Here is my variable definition (notice that there is no leading equals sign. Also mind the 's and "s):

'=''|''&Concat({1<"' & $1 & '"=>} DISTINCT "' & $1 & '",''|'')'

Notice the 1 that's part of the set expression (not to be confused with $1).

This is the expression in my text object:

=$(=$(vPassParam(GetCurrentField("High-Level Posn Break")))), where "High-Level Posn Break" is the name of a group.

Which gives me a beautiful list of all the items in that field, separated by |s. The list also changes depending on what dimension is selected in the group, as expected.

However, when I put the same expression into a straight table, the expression doesn't work unless I remove the equal sign. Additionally, I only get the value for element of the dimension corresponding to the row, not the whole list like I need. If I don't use the variable, but rather type this expression:

='|'Concat({<{MV Break Bucket]=>} DISTINCT [MV Break Bucket],'|')

then I get the full list on each row as expected.

Can anyone help me get the parameterized variable to work? It would make it so that I could use it for every dimension I wish instead of having to create a variable for each dimension.

I hope this wasn't too rambly!

1 Solution

Accepted Solutions
jagan
Partner - Champion III
Partner - Champion III

Hi,

Try like this

'=''|''&Concat({1<"' & $1 & '"=>} TOTAL DISTINCT "' & $1 & '",''|'')'


If not works then post some sample file and expected output.


Regards,

jagan.

View solution in original post

4 Replies
jagan
Partner - Champion III
Partner - Champion III

Hi Eric,

Try like this

Variable Declaration - vPassParam

'=''|''&Concat({1<"' & $1 & '"=>} DISTINCT "' & $1 & '",''|'')'

Expression in Straight Table:

$(=$(vPassParam(GetCurrentField(GroupName)))) -- Note = at the begining

This is working for me.

Regards,

Jagan.

Not applicable
Author

Hi Jagan,

I don’t see any differences in the two expressions. When I use yours I get only one value back, not the full delimited list. Are you getting the full list on every line?

jagan
Partner - Champion III
Partner - Champion III

Hi,

Try like this

'=''|''&Concat({1<"' & $1 & '"=>} TOTAL DISTINCT "' & $1 & '",''|'')'


If not works then post some sample file and expected output.


Regards,

jagan.

Not applicable
Author

Hi Jagan,

That worked, thanks!