Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
NielsCoolen
Contributor II
Contributor II

Give a client a value based on if-statement

Hello everyone!

I have got a client and he's got multiple types of addresses (home address, postal address, invoice-address, etc.).

My data looks like this. It is the Client_Adresses table:

ClientAddress TypeAddress
Mr. AdamsA

Street 1

Mr. AdamsCRoad 2
Mr. AdamsDLane 5
Mr. SmithBLanestreet 3
Mr. SmithCMainroad 2
Mr. SmithEPath 1
Mr. RichardsAAvenue 3
Mr. RichardsDPathway 7

 

In a different Client-table, I just want to maintain 1 address for each client. Where I make use of an if-statement to figure out which address is the 'default address' to use.

E.g. if client has type A then use type A as default address. Else, if client has type C, use type C as default address. Else, if client has type B, use type B as default address. And so on, and so on.

 

But I'm trying to figure out how to script this.
Can anyone give me any pointers? What are useful functions?

 

Thank you so much in advance!

2 Replies
PrashantSangle

one query. in above sample data one client have both type of address then which type is default address you want to give??

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
NielsCoolen
Contributor II
Contributor II
Author

I have a logic in my mind. Some clients have all types of addresses and some only have 1 or 2.

I want to give each client 1 default address, based on the logic I have in my mind:

 

if(Client has Type A, Type A,
   else if(Client has Type C, Type C,
      else if(Client has Type B, Type B,
         else if(Client has Type E, Type E, Type D))))