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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
joe86
Contributor
Contributor

Pick value based on condition

Hi All,

I am working on a scenario. I have two tables.

1. Table1 has all the final output data.

2. Table2 has list of officialType & Certificates to be completed for those officials.

 

My Scenario:

I have to load only those records whose certificates are going to expire (in next 7 days) based on the OfficialType (in Table2).

If the official is an Coach, then the certificates (to be expired in next 7 days) assigned to him (either C1, C2, C3) should only flow to final Table1. Same condition applies to other OfficialType also.

Table:1

AppIDVenueContactOfficalC1C2C3C4C5
1abc123Coach21/12/2018    
2asc124Coach 20/12/2018   
3zxc125DSO   19/12/2018 
4aqw126Vol    19/12/2018
5qqw127Vol    20/12/2018
6ret128DSO   20/12/2018 
7fgh129Coach  19/12/2018  
8gbm130Coach 18/12/20183   

Table2:

OfficialCertificate
CoachC1
CoachC2
CoachC3
DSOC4
VolC5

 

If C1 date (from incoming source) is going to expire within next 7 days, then i have to populate only that date in Table1 (as shown in AppID=1 in Table1). Since other two certificates (C2, C3) for Coach does not expire in next 7 days, they will not flow into Table1 for AppID=1. Same condition for other two OfficialType also.

 

can some one please share me your thoughts.

 

Note: The list of certificates for each OfficialType can vary based on requirement.

Labels (2)
10 Replies
Anonymous
Not applicable

Hi,

 

     I was able to create the flow but I will have to say that your current model is not scalable as every new certificate addition means change in the code.

 

   Having said that, below is the flow.

0683p000009M1k8.pngjob flow

 

0683p000009M1kD.pngoutput

 

Below are the individual component screenshots.

0683p000009M1kI.png

 

0683p000009M1LF.png

 

0683p000009M1kS.png

 

tmap expression of C1 same for all  columns)

TalendDate.diffDate(row2.C1,TalendDate.getCurrentDate(),"dd",true) <=7? row2.C1:null 

0683p000009M1LG.png0683p000009M1kc.png0683p000009M1YD.png

 

!Relational.ISNULL(out1.C1) &&  row5.certificate.contains("C1")? out1.C1: null 

You will get the desired output from tmap.

 

Warm Regards,
Nikhil Thampi

Please appreciate our members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂