Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
prahlad_infy
Partner - Creator II
Partner - Creator II

How Flagging a key field value of a table based on the presence of key value in other table ?

Hello Experts ,

I do not know how to flag value  as 1 or 0 in a table2  based on availability of  field value present in another TABLE1 .

 

FLAG.PNG

 

 

TABLE1:
LOAD * INLINE [

Key1, Measure1, Text
A01, 0.675110413, Q
A02, 0.090633909, B
A03, 0.499721274, C
B01, 0.936585255, Q
B02, 0.544804541, A
B03, 0.287134415, C
C01, 0.017603298, A
C03, 0.179289247, A
C05, 0.464438103, B
];

TABLE2:

LOAD * INLINE [

Key, Measure2, REGION
A01, 0.607192136, R1
A02, 0.424057594, R1
B03, 0.224355685, R2
B04, 0.10428929, R1
B05, 0.687693804, R2
C03, 0.833436445, R2
C05, 0.318838755, R3
];

 

Thank You .

1 Solution

Accepted Solutions
prahlad_infy
Partner - Creator II
Partner - Creator II
Author

Thank You Sir . 

So Lookups are there .  

View solution in original post

4 Replies
prahlad_infy
Partner - Creator II
Partner - Creator II
Author

Sir @Kushal_Chawda ...

Is there way , without using where Exists / Join ? 

 

 

sunny_talwar

Try this

TABLE1:
LOAD * INLINE [
    Key1, Measure1, Text
    A01, 0.675110413, Q
    A02, 0.090633909, B
    A03, 0.499721274, C
    B01, 0.936585255, Q
    B02, 0.544804541, A
    B03, 0.287134415, C
    C01, 0.017603298, A
    C03, 0.179289247, A
    C05, 0.464438103, B
];

TABLE2:
LOAD *,
	 If(Len(Trim(Lookup('Key1', 'Key1', Key, 'TABLE1'))) > 0, 1, 0) as Flag;
LOAD * INLINE [
    Key, Measure2, REGION
    A01, 0.607192136, R1
    A02, 0.424057594, R1
    B03, 0.224355685, R2
    B04, 0.10428929, R1
    B05, 0.687693804, R2
    C03, 0.833436445, R2
    C05, 0.318838755, R3
];
prahlad_infy
Partner - Creator II
Partner - Creator II
Author

Thank You Sir . 

So Lookups are there .  

sunny_talwar

Yes, Lookup function does exist in Qlik.

Also, please call me Sunny (no sir needed)