Skip to main content
Announcements
YOUR OPINION MATTERS! Please take the Qlik Experience survey you received via email. Survey ends June 14.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

ValueList

Hi All,

I have a created a dimension with value list as valuelist('xv7z','yx7c','xcv7r').

i have an expression like


if(valuelist('xv7z','yx7c','xcv7r')='Xv7z',1,0)

but now i want to take that numerical value with an variable assigned to an input box.
can any one help me how to achieve it.

5 Replies
tresesco
MVP
MVP

Which numerical value? 7/1/0?

Not applicable
Author

Hi Tresesco

its 7

jonathandienst
Partner - Champion III
Partner - Champion III

Hi

I'm not sure exactly what you want...

If you want to use a variable in your expression (say vSetValue) in a chart or table with the valuelist as a dimension, then use:

    

     =If(valuelist('xv7z', 'yx7c', 'xcv7r')='$(vSetValue)', 1, 0)

A valuelist() expression inside a chart or table cannot be referenced from another sheet object. If that's what you are trying to do, then use an inline load to create a field containing the values in the valuelist and use this field as a dimension instead.

HTH

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
tresesco
MVP
MVP

Check attached qvw.

petter
Partner - Champion III
Partner - Champion III

When using the expression If( ValueList('xv7z','yz7c','xcv7r')='Xv7z',1,0) in a chart the ValueList()-part will

return one of the values - actually the one corresponding to the charts straight table equivalents row. (The dimension which has the ValueList() will iterate and pick each of the values)

Specifically in your case the first row in the chart the ValueList('xv7z','yz7c','xcv7r') will return the first value 'xv7z', for the second row the second value 'yz7c' and lastly for the third row it will return 'xcv7r'.

In an input box you will - if you evaluate this expression directly into a variable like this:

     =If(ValueList('xv7z','yz7c','xcv7r')='Xv7z',1,0)

get a set of three values and never get a single value from the ValueList('xv7z','yz7c','xcv7r').

So if you don't have a chart with a dimension corresponding to the ValueList you will always get the full value set.

Outside of a chart (Text Object, Input Box and other non-chart sheet objects) you can use some kind of extra function to pick out one of the values or aggregate the set of values with an aggregation function.

For instance:

    =ValueList('xv7z','yz7c','xcv7r')                                      in an input box will show a dash '-' ...

           (which is QlikViews way of saying it dont know what to do with the set of values )

However if you do this:

    =Count(ValueList('xv7z','yz7c','xcv7r'))                         in an input box will show 3

Or if you need to display the entire set:

     =Concat(ValueList('xv7z','yz7c','xcv7r'),'/')                   will show  xv7z/yz7c/xcv7r   as a concatenated string/text

You can also pick a single value like this:

     =Pick(2,$(=Concat(ValueList('xv7z','yz7c','xcv7r'),',')))   will show yz7c