Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I'm new to Talend Studio for Data Integration and am trying to understand how to manage a set of references which can be managed in a data source used in a transformation. I have another post in here because I don't have tStandardizeRow in my palette and cannot seem to find out how to install it if it is the right tool for the job.
What I want to set the value of "Asset" based upon a series of one or more conditions. If I wrote it as an IF THEN ELSE set of steps, it would look like this:
IF origin.Instrument Type equals 'Future' |
Set VALUE to destination.Asset VALUE = 'General Future' |
ELSE Set VALUE to destination.Asset VALUE = 'General Equity' |
IF origin.Instrument Type equals 'Option' |
Set VALUE to destination.Asset VALUE = 'General Option' |
|
IF origin.Instrument Type equals ('Equity' OR 'Warrant') AND origin.Custodian Account Display Name equals 'CFD' |
Set VALUE to destination.Asset VALUE = 'Equity' |
|
IF origin.Instrument Type equals 'Bond' AND origin.Custodian Account Display Name equals 'CFD' |
Set VALUE to destination.Asset VALUE = 'Fixed Income' |
|
IF origin.Instrument Type equals 'Credit Default Swaption' AND origin.Custodian Account Display Name equals 'CFD' |
Set VALUE to destination.Asset VALUE = 'Swaption' |
|
IF origin.Instrument Type equals 'Interest Rate Swap' |
Set VALUE to destination.Asset VALUE = 'IRS' |
|
IF origin.Instrument Type equals 'CDS' |
Set VALUE to destination.Asset VALUE = 'CDS' |
|
IF origin.Instrument Type equals 'Repurchase Agreement' |
Set VALUE to destination.Asset VALUE = 'Repo' |
Hi,
Could you please try tMap (use condition expressions) or tJavaRow (where you can write Java if-else conditions) to resolve your use case?
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
Thanks for your response, I wanted to try to achieve this without codes using reference or rules data and apply one or more rules to a value in the mapping. If I end up adding Java into the mapping then the references themselves cannot be managed outside of the map by non-technical business users. How would you approach this without hard-coding rules and values?
Thanks, Matt
Most of your conditions center around mapping Instrument Type to a desired Asset value. Some of the conditions don't appear to be fully covered. (ex: What happens if the Instrument Type is Bond and the Custodian Account Display Name is not CFD?)
I would probably approach this as a lookup table, stored either in a database or a file that maps Instrument Types to their corresponding Asset values. I would apply the lookup regardless of conditions on the Custodian Account Display Name and simplify the conditional to use the lookup value or some replacement value.
If you want to avoid checking the value of CADN in the code at all, then you can either include all the CADN values in the lookup table or else just the mappings when CADN = 'CFD' and != 'CFD'.
Ex:
Instrument Type CADN Asset ====================================== Future General Future Option General Option Equity CFD Equity Equity Other Bond CFD Fixed Income Bond CFD Other
DEFAULT DEFAULT VALUE etc.
This would allow changes to the mappings without needing to update the Talend job. You might need to apply the mappings more than once, and might need a special routine to handle and apply the default value for cases not handled by the rest of the mapping table.
Hi,
If your use case is related to creation validation rules by business users themselves, one approach will be to provide Talend Data Prepartion tool for the business users. They can create all the data quality use cases themselves since the Talend Data preparation allows the business rules creation like a smart excel sheet.
Once they create the Rules using Talend Data Preparation, you can use those recipes within Talend Studio by connecting to those recipes. Then you can implement these rules for production loads.
https://www.talend.com/resources/what-is-data-preparation/
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