Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Load table twice and union all after difference filtering

Hi

How can I filter below product table by Series and Family based on User Id?

In SQL, if “user1” will load Family = ‘F1’ and Series = ‘S3’, I will do

Select * from Products where Family = ‘F1’

Union

Select * from Products where Series = ‘S3’

How can I do this in QlikView script?

Table - Products

ProductId, Series, Family

P1, S1, F1

P2, S2, F1

P3, S3, F2

P4, S4, F2

Thanks

Wilson

6 Replies
tresesco
MVP
MVP

May be like:

Load * from Products where Family = ‘F1’;

Concatenate              // this is optional here since all fields are common in two loads (it gets auto concatenated)

Load * from Products where Series = ‘S3’;

Not applicable
Author

Thanks Tresesco Biswas.

But I need to do filter based on login.  So i will do it using load inline table and join.

I cannot do filter directly on SQL statement.

Thanks

Wilson

tresesco
MVP
MVP

Not sure if I understand right. I guess you need to have a look at Section Access :Introduction to Section Access

Anonymous
Not applicable
Author

Hi,

As tresesco point out, if your data reduction is based on the user/login of the dash, then you can use Section Access to control that. If you want the dash itself only show specific data, then you can directly use the SQL in the load script.

And by the way, your case if the data is from the same table, the SQL query can be simpler like below:

Select * from Products where Family = ‘F1’ or Series = ‘S3’;

Zhihong

Not applicable
Author

Yes, your understanding is correct.  But how can i do two filters? I have already added one like this

Section Application;

Control:

LOAD * INLINE [

UserId, Family

User1, F1

User2, F2

];

I think i cannot do this because S3 does not under F1. S3 is under F2.

Control:

LOAD * INLINE [

UserId, Family, Series

User1, F1, S3

User2, F2, *

];

Thanks

Wilson

Not applicable
Author

Hi Zhihong,

If I have 5 users, how many SQL statements i should prepare? it is more reasonable to do it using section access.

Thanks

Wilson