Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

OR selection in multiple fields

Hi guys,

I need to make a selection in various fileds: ex. the colour "yellow" in the "cars" selection table OR (not AND) in the bicycle one, and get the result at the same time.

Has anybody an idea for me?

Thanks.

N.

1 Solution

Accepted Solutions
swuehl
MVP
MVP

What about the attached solution, right side of the sheet. I used a data island for cycle to emulate the alternate state and added the logic for checking actual selections in fields.

View solution in original post

25 Replies
ronnywaage
Contributor III
Contributor III

‌hi

Not so easy to answer based on the information you have provided.

But one simple trick that may be usefull is to use bicycle = , in your set expressions for the car table. Then you will see the yellow cars regardless of what you select for bicycle.

rw

Anonymous
Not applicable
Author

Well, I'll try to explain myself better....

I have two listbox fields, showing the family transport items (every family has both of them): one for the cars and one for the bicycles.

I'd like to let the user to make two selection extracting the families with a value in a field OR a value in another field (not with a value in a field AND a value in another field, as how qlik usually works); for example I'd like to let to extract the families with a yellow car (not caring about the bycicle colors) OR a yellow bycicle (not caring about the cars color), not only the families with a yellow car AND a yellow bycicle (as qlik work when I make two selections in two separate listbox.

Hope it's more clear now.

Thanks.

N.

ronnywaage
Contributor III
Contributor III

‌hi

I am struggeling to log on to the community with my laptop so here is a short version of one alternative I have tested.

Lets say you have a table with family_name, color_car and color_bicycle. And you want to list all families with a yellow car or bicycle.

i Created two alternati states CAR and CYCLE. The color_car dropdown list was linked to the CAR state and the other dropdown was linked to the CYCLE state.

then i created a chart with the followin expression

Rangemax(

count({$<

    Color_car = CAR::color_car,

    Color_bicycle =

  >}family_name),

count({$<

    Color_car = ,

    Color_bicycle = CYCLE::color_bicycle

>}family_name))

swuehl
MVP
MVP

Using alternate states is a good approach here, but I think the expression could be simplified to

Count( {CAR+CYCLE} family_name)

creating the union of both states.

See attached a simple sample QVW.

ronnywaage
Contributor III
Contributor III

‌Nice.

Anonymous
Not applicable
Author

ok, sorry if I'm not so skillful as you are...but how can I make the selection to extract the families having a yellow car OR a yellow bicycle (that is the families #1,#2, #3)?

I'm not able to manage the right-selections of your qw sheet....Can you post me a print-screen of it?

Thank you.

N.

ronnywaage
Contributor III
Contributor III

Hi

If you are able to open the example file you should add the dimension Family to the table to the right (the table with caption (Count({CAR+CYCLE}Family)...

You can also update the load script in the example to show a name instead of a family number:

LOAD * INLINE [
Family, Car, Cycle
Aaa, blue, yellow
Bbb, yellow, blue
Ccc, yellow, yellow
Ddd, blue, blue
]
;

That gives me this result in the example

   

CarCycleFamilyCount({CAR+CYCLE}Family)
3
blueyellowAaa1
yellowblueBbb1
yellowyellowCcc1
swuehl
MVP
MVP

The set {CAR+CYCLE} can be used in any aggregation function to retrieve the record set based on your selections in alternate state CAR OR CYCLE (right hande side in my sample app).

For example, create a text box with

=Concat({CAR+CYCLE} Family, ', ')

will just return a comma separated list of these families '1, 2, 3'

Anonymous
Not applicable
Author

ok, it's not so easy for me to explain myself...I'd like to know how does the user make the selection to extract the families who have at least one condition verified, and not only the family who has both of them verified.

Selection.jpg

As shown in this print screen, when I select (on the right list boxes) the yellow car and the yellow bike, it extracts only one family both in the right and in the left table: contrariwise in the right table, the OR table, I expected to extract three families, the #1, #2 and #3 who have the yellow car OR the yellow bike (or both of them).

Hope it's much clear now...

Thanks.

N.