Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
aniruddhyadutta
Creator
Creator

problem implementing both AND and OR condition in qlik

Hi All,

I do have a requirement where I need to implement both AND and OR condition to replicate a sql code which is like this below in the where condition for 2 tables a1 and a2.

a1.sbi_sender_id=a2.source_id and a1.sbi_receiver_id=a2.destination_id

                                                     or

                                                  a1.sbi_receiver_id=a2.destination_id

                                                   OR

                                                   a .1.sbi_sender_id=a2.source_id)

So here you see we are using the same set of condtions once for AND and once for OR.

I followed an approach like this:

load

SBI_RECEIVER_ID as DESTINATION_ID ,

SBI_SENDER_ID as SOURCE_ID

from qvd(table a1)

inner join

LOAD

SOURCE_ID,

DESTINATION_ID

BU

from qvd(table a2)


//**********for AND condition************//

concatenate


load

SBI_RECEIVER_ID as DESTINATION_ID ,

SBI_SENDER_ID

from qvd(table a1)

inner join

LOAD

SOURCE_ID,

DESTINATION_ID

BU

from qvd(table a2)

//**********for OR condition************//

concatenate

load

SBI_RECEIVER_ID ,

SBI_SENDER_ID as as SOURCE_ID

from qvd(table a1)

inner join

LOAD

SOURCE_ID,

DESTINATION_ID

BU

from qvd(table a2)

//**********for 2nd OR condition************//


I may need to add a distinct to the final dataset.


But is there any elegant solution to this like how like kind of scenario is being handled in qlik?


can I have this covered in an applymap code to get the BU?



0 Replies