Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Announcements
Customers, Partners & Luminaries only: You're invited to a Data Analytics Roadmap session. Read More
cancel
Showing results for 
Search instead for 
Did you mean: 
Partner
Partner

Variable Not Expanding in Set Analysis

Hello,

I have the folllowing set expression that uses a variable to retrieve the text I'm looking for in the set modifier.

Set Expression:  Sum({$<TranType = {'$(vTRLV)'}>} [Actual Sales])

Variable: vTRLV = GetFieldSelections(zPerspective)

The values in the zPerspective field are the following.

  • LV
  • TR

I have a text box with =$(vTRLV) that does display either the LV or TR when I select a parameter in the zPerspective List Box. However, the variable in the set expression above is not expanding to the selected parameter.  The set expression does work when I hard code the set modifier with either 'LV' or 'TR'. 


I'm not seeing where I'm dropping the ball.


Any help will be very much appreciated! 


Thank you,


1 Solution

Accepted Solutions
Highlighted

I don't see why you need this variable, by default if you model is connected properly the selections will filter the expression. But if you still want to this for some reason, then try this:

Variable: vTRLV = Chr(39) & GetFieldSelections(zPerspective, Chr(39) & ',' & Chr(39)) & Chr(39)

Sum({$<TranType = {$(vTRLV)}>} [Actual Sales])

View solution in original post

7 Replies
Highlighted

I don't see why you need this variable, by default if you model is connected properly the selections will filter the expression. But if you still want to this for some reason, then try this:

Variable: vTRLV = Chr(39) & GetFieldSelections(zPerspective, Chr(39) & ',' & Chr(39)) & Chr(39)

Sum({$<TranType = {$(vTRLV)}>} [Actual Sales])

View solution in original post

Highlighted
Partner
Partner

Hi Sunny,

Still not working.  Not getting any values in the set expression.  I do see the difference in the variable.  It is now showing the quotes around the value.

Based on your response, the model is connected properly.  Don't see how the selections will filter in the expression. 

Highlighted

GetFieldSelections usually get the value of what is being selected. If your expression is not restricted using {1<>} (one) it is suppose to filter based on selection. Why do you need to explicitly do the same thing? The only time it won't work is if the field is not connected to the chart dimensions. Does it make sense?

Highlighted
Partner
Partner

Makes sense.  Thanks.  I checked the data model and see that the zPerspective field is not connected to the model.  I inherited this app and are dealing with an extremely poor data model.  I'll see what I can do to connect the field to the model.

Thanks for your help! 

Highlighted

Not a problem, I am glad we have found the issue

Highlighted
MVP
MVP

Is your variable defined with a leading equal sign or without?

If there is no leading equal sign, try to add one.

Highlighted
Creator
Creator

Try removing the single quotes from the expression:

Sum({$<TranType = {$(vTRLV)}>} [Actual Sales])

Miguel Gavidia