Four Stars

tMap and conditional join

Hi,
I'm trying to join a customer row with start and end dates to a generic calendar in tMap, so that I could get the following result
Customer:
CustomerX, 2012/01/01, 2012/01/04
Joined with calendar:
...
2012/01/01
2012/01/02
2012/01/03
2012/01/04
...
Output:
CustomerX, 2012/01/01
CustomerX, 2012/01/02
CustomerX, 2012/01/03
CustomerX, 2012/01/04
I tried to enter the logic in tMaps "Expr. key" like this:
cust.StartDate <= calendar.Date && cust.EndDate >= calendar.Date
But it seems that "Expr. key" doesn't work like that.
How can I do a join like this?
3 REPLIES
Employee

Re: tMap and conditional join

Hi,
I think you can try the component tIntervalMatch to do this case.
https://help.talend.com/search/all?query=tIntervalMatch&content-lang=en
regards
Four Stars

Re: tMap and conditional join

tIntervalMatch seems to do the lookup backwards. In order to get the correct amount of rows, I need to bring the calendar in as main and use my real data as lookup, so that I can define the correct min/max values. But this prevents me from bringing any other columns from my data except the lookup-column.
I could do normalize/denormalize before and after the intervalmatch, but that seems a really clunky solution.
Are there any other ways I could achieve what I'm trying to do?
Seven Stars

Re: tMap and conditional join

Will this or this (both essentially do the same thing) work for you?