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: 
michal_l
Contributor
Contributor

defining a list variable according to selection

hi,

I have a qvd file with a variable "Type" which has numerical values from 5000 to 7000.

These values can be categorized to products: A, B , C - but a value can be categorized to more than on product. For instance, values 5201 is also in product A and also in B.

my App has a selection for the type of products you're interested in viewing. I want to show the viewer the number of observations which are relevant to the selected product. I want to do the following steps (unless you can think of a more efficient way!) but need help with syntax:

 a. create a list variable for each product and in it put all the relevant "type" numbers. for example:

set vProductA = 5501,5201;

b. create a list variable for each product which receives the value of  the list variable if that product is chosen, and an empty list set  otherwise. for example:

if((wildmatch(GetFieldSelections(product,';','*A*')))> 0, vProductAchoose=$( vProductA ),vProductAchoose={})

c. create a variable which is a join of step b variables:

set vProductChosen =sum({<vProductAchoose>+<vProductBchoose>+<vProductCchoose>})

d. count all observations in this new list:

=count({<Type={"vProductChosen"}>} observation)

 

what is the correct syntax for steps b-d?

 

thankyou!

1 Reply
marcus_sommer

I'm not sure if I understand your task but I think I wouldn't try your described approach else I would try to match everything within the datamodel so that I could use "normal" selections and expressions. In your case with multiple categories per product might an as-of table be useful: The-As-Of-Table to define such a relation.

- Marcus