Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello!
I have one mapping issue. The issue goes like:
I have a fact table:
fact id | Element_id | B_type |
1 | 23.A01-01-PV | 15 |
2 | 23.A02-01-PV | 15 |
3 | 23.A03-01-PV | 20 |
Then I have a rule table like:
Rule id | filter element id | Filter B_type |
1 | 23.A | 15 |
2 | 23.A01 | 15 |
3 | 23.A02-01-PV | 15 |
I want to create an X-ref table between both of them. For this I need to comapre the pattern in rule table and use the Filter B_type.
Final Output:
fact id | Rule id |
1 | 1 |
1 | 2 |
2 | 1 |
2 | 3 |
To comapre the strings, I broke element_id in both the tables in TMap like following
Fact Table:
Element_id | Bdel | Group | Undergroup | LNO | Component |
23.A01-01-PV | 23 | A | 01 | 01 | PV |
23.A02-01-PV | 23 | A | 02 | 01 | PV |
23.A03-01-PV | 23 | A | 03 | 01 | PV |
Rule Table:
filter element id | Bdel | Group | Undergroup | LNO | Component |
23.A | 23 | A | Null | Null | Null |
23.A01 | 23 | A | 01 | Null | Null |
23.A02-01-PV | 23 | A | 02 | 01 | PV |
Unfortunately now I am stuck. I dont know how to comapre these two in TMap to produce the Final output mentioned above.
How can I do it?
Regards
Priyadarshini
Hi Priya,
I hope the below solution will help you (Note:- In your sample output, you did not mention the combination for fact_id 3. I hope it was accidental)
Please refer the tMap details below.
row3.element_id.contains(row4.filter_element_id)
On a lighter note, I hope your team members looking for regular expression won't complain this time
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 🙂
Hi Priya,
I hope the below solution will help you (Note:- In your sample output, you did not mention the combination for fact_id 3. I hope it was accidental)
Please refer the tMap details below.
row3.element_id.contains(row4.filter_element_id)
On a lighter note, I hope your team members looking for regular expression won't complain this time
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 🙂
Hello @nthampi !
Thank you so much for your reply. The solution works but fails when I add a condition. As you can see in the example, there is one more filter called Filter B_TYPE. So in the expression filter, I added this
row3.element_id.contains(row4_Element.FILTER_ELEMENT_ID) && row3.type.equals( row4_Element.FILTER_B_TYPE). Is it not correct?
Regards
Priya
Hi,
It worked fine for me!
row1.Element_id.contains(row2.filter_element_id) && row1.B_type.equals( row2.Filter_B_type)
Please check whether you are adding variables in right case. That could be the reason.
We have resolved both your original and supplementary query now 🙂 If all looks fine, please spare a second to mark the topic as resolved.
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 🙂