Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Jason_Michaelides
Luminary Alumni
Luminary Alumni

"OR" selection in searches or across fields

Hi all,

This has got to be such a common request but I can't find a solution anywhere!

Let's say I have a simple table of USERS, each with a Job_Title and a Company_Type. I want to do 2 things:

1. Select all users who have *digital* in their job title OR have *marketing* in their job title

2. Select all users who have a job title of "CEO" OR a company type of "Limited Company"

Just can't seem to work it out! Can anyone help...?

Thanks,

Jason

9 Replies
Not applicable

Hi! Jason,

As per my understanding

1. create a list box for JOB TITLE and select 'DIGITAL' thn by holding shift select' MARKETING'.

u can see all the related details in the other list boxes whos job title is digital or marketing.

2. use expression.

if([job title]='CEO' or [company type]='Limited Company',users)

hope this ll help you...

Dixit Patel

Jason_Michaelides
Luminary Alumni
Luminary Alumni
Author

Hi Dixit,

Thank you for your response but I think you've misunderstood my requests.

1. I don't need to select the discreet values "DIGITAL" and "MARKETING" - I need ALL job titles with (for example) the word "digital" OR the word "marketing" somewhere within the job title.

2. CEO and Limited Company were just examples - it could be any combination that is selected, so I can't pre-create expressions for all possible options.

Any other ideas?

Thanks,

Jason

johnw
Champion III
Champion III

1a) Search for *digital*. Select the values. Search for *marketing*. Use CTRL to add the values to your selections.
1b) In the search box, type =wildmatch(Job_Title,'*digital*','*marketing*')

2) I can't think of a practical way to do this for arbitrary combinations of fields. QlikView does AND between fields. There are ways to set up OR tables, but they take a lot of data, probably far too much to be able to combine ALL fields in this way. Attached is one type of OR table.

johnw
Champion III
Champion III

And here's another type of OR table. It uses much less memory, but seems less user-friendly.

Jason_Michaelides
Luminary Alumni
Luminary Alumni
Author

Thanks for your response John.

1a) - that work, thanks. Unfortunately it's not practical as there are thousands of job titles and CTRL-clicking on the hundreds that contain "marketing" won't go down well with the users.

1b) - couldn't get this to work at all. Not in the search box of the list box, nor in a search object. Works in a chart calculated dimension but not as an easy search. Any ideas? I'm using v9sp6

2) I'm afraid I can't make heads nor tails of these documents! It's 11pm here right now so I'll give it another go tomorrow but I'm really not sure I'll follow what's going on. Can you provide a brief overview?

Thanks again,

Jason

johnw
Champion III
Champion III


jason.michaelides wrote:1a) - that work, thanks. Unfortunately it's not practical as there are thousands of job titles and CTRL-clicking on the hundreds that contain "marketing" won't go down well with the users.


Fair enough. Is it possible to simply organize the information better by adding new fields? For instance, a marketing flag, or a Job_Type field with value 'marketing'? If so, it's trivial to select the 'marketing' and 'digital' values, or to select Y for the marketing and digital flags. That may not be practical, of course.


jason.michaelides wrote:1b) - couldn't get this to work at all. Not in the search box of the list box, nor in a search object. Works in a chart calculated dimension but not as an easy search. Any ideas? I'm using v9sp6


Works for me in list boxes and multi-boxes. Doesn't seem to work in search boxes. Look for "advanced search" in the help text for more information. I'm on v9SR5, but I doubt that's the problem.


jason.michaelides wrote:2) I'm afraid I can't make heads nor tails of these documents! It's 11pm here right now so I'll give it another go tomorrow but I'm really not sure I'll follow what's going on. Can you provide a brief overview?


TestOR5 takes advantage of the fact that QlikView's behavior in a SINGLE list box is OR. So it simply puts every field and every value of every field you care about in ONE list box. Each of these values is connected to the ID of the records that have that value for that field. So if you select values from two different fields, you'll get all of the IDs that either connect to. So you get OR across multiple fields.

TestOR6 is more complicted. It loads every possible combination of fields. So look at ID 1 for instance. It has every possible combination of values except for A=N, B=Y and C=Y. It doesn't have THAT row because it's the exact opposite of the actual values. The result of this massive combination of fields is that if you select a value for one, every possible value for the others is still allowed, and aren't constrained by your first selection. So if you select a value of Y for field A, it no longer matters what is in fields B and C. ID 1 WILL be returned.

It's impractical for a couple reasons. First, for anything more than a trivial example like this, the table would be massive. It would probably never load. Second, it isn't very user-friendly. Any field that doesn't have a selection made in it means that ALL values are allowed for that field. And if you're doing an OR with every possible value for some field, then you haven't really narrowed down your list at all. The only way to do that is to make SOME selection for EVERY field. And that's ridiculous except for maybe some very rare very specific requirement. What you really need is a way to select nothing, and have that be the default. No such luck.

So I really can't suggest TestOR6, and in hindsight probably shouldn't have included it.

Not sure I can really suggest TestOR5 either, but at least you could actually do the load, and when you select something, it stops allowing every value for every other field. Might be better than nothing, even if it isn't good.

Anonymous
Not applicable

Jason,
I had this exactly problem as well. See my solution here on Share QlikViews.

johnw
Champion III
Champion III

Ah, OK. So you have a value 'ALL' in each table that remains always possible, and connects to every ID. That seems better than what I've come up with. I need to remember that one. I remember seeing your example before, now that I'm seeing it again, but the idea just didn't stick in my head. Must remember it. Ah, I'll save it as TestORMichaelBestSolution. That way, I'll be sure to see it next time I go searching for OR in my library of examples. 🙂

Anonymous
Not applicable

Thanks John,
Frankly, when I uploaded this solution I hoped that somebody had a better idea... Tongue Tied