Populate data on the basis of priority

Seven Stars

Populate data on the basis of priority

I am stuck with a scenario, given below,

 

I need to populate target table on the basis of some priority on source data, if the high priority record found then other records should not load into target from the same group, it should be get rejected. If the high priority item not found, it should check other below priority record, if found, load the same into target and ignore other records in the same group, example below,

 

Priority Order:

1. sfdc

2. sfdc,dc,fg ( if channel like '%sfdc%')

3. *

 

Note: There is no specific KEY column available, combination of columns can make a KEY.

1. if source data comes like below, it should load only last record, 

name chargecode groupcode channel
sme1 50958 5098 *
sme1 50958 5098 sfdc,dc,fg
sme1 50958 5098 sfdc

 

2. In this case 2nd record should loaded

name chargecode groupcode channel
sme1 50958 5098 *
sme1 50958 5098 sfdc,dc,fg

 

3. If the source record coming with single channel, then it should load, so in this case priority is not required,

name chargecode groupcode channel
sme1 50958 5098 sfdc,dc,fg

 

name chargecode groupcode channel
sme1 50958 5098 *

 

name chargecode groupcode channel
sme1 50958 5098 sfdc

Accepted Solutions
Employee

Re: Populate data on the basis of priority

Hi,

 

    The most easy method is to have a ranking config table for each channel and then do a lookup with this table to get the ranking for each record. Order the incoming data based on key columns and rank. Then for each data group (using taggregaterow), pick the first record which is having highest rank.

 

    This should resolve your issue.

 

Warm Regards,
Nikhil Thampi

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


All Replies
Forteen Stars

Re: Populate data on the basis of priority

@Vibin_CT ,check the below one.

 

Untitled.pngUntitled.png

Manohar B
Don't forget to give kudos/accept the solution when a replay is helpful.
Employee

Re: Populate data on the basis of priority

Hi,

 

    The most easy method is to have a ranking config table for each channel and then do a lookup with this table to get the ranking for each record. Order the incoming data based on key columns and rank. Then for each data group (using taggregaterow), pick the first record which is having highest rank.

 

    This should resolve your issue.

 

Warm Regards,
Nikhil Thampi

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

Seven Stars

Re: Populate data on the basis of priority

@nikhilthampi:

 

Thank you very much!!  Smiley Happy

 

@manodwhb: Thanks for your quick response, but your first condition won't provide expected result, because if we find channel with only 'sfdc', we should ignore other records from the same group. I am okay with the solution provided by @nikhilthampi .

Employee

Re: Populate data on the basis of priority

Thanks for the update @Vibin_CT 

 

Since you have the solution, could you please mark the topic as closed? Kudos are also welcome :-)

 

Warm Regards,
Nikhil Thampi

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

2019 GARNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Talend Cloud Developer Series – Updating Context Variables

This video will show you how to add context parameters to a job in Talend Cloud

Watch Now

Talend Cloud Developer Series – Deploying First Job to Cloud

This video will show you how to run a job in Studio and then publish that job to Talend Cloud

Watch Now

Talend Cloud Developer Series – Fetching Studio License

This video will help someone new to using Talend Studio get started by connecting to Talend Cloud and fetching the Studio License

Watch Now