Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All,
I have a input file like below
the data in 2 columns are single row
my requirement is - in date1 col we have 2 dates and date2 col has 3 dates
so my output should be like below
The records in the cell are separated by new line (\n)the <default value> is based on date 2 col as its having 3 dates entries.
If date1 col has one date then the default values should in 2 entries
Anyone can please help me to how to achieve in talend
Thanks in advance,
lmit
Hi
"f date1 col has one date then the default values should in 2 entries"
Can you explain this sentence with an example? what should be the default value in this case.
Regards
Shong
Hi @Shicong Hong , Thanks for the reply,
i mean if my date is like below
and lets say my default value is abc , then my output should be like below
Thanks,
lmit
@none none , have you tried tNormalize component, read the cell value a string, then use tNormalize to split the string to multiple rows.
Regards
Shong
@Shicong Hong , I tried using tnormalize but am not able to add default value .
and if I use tnormalize on date1 , it is giving 2records
while on date2, it’s giving 3 records
but for date1 col I want 3 records.
thanks,
lmit
after you split string the multiple rows using tNormalize, link it to a tMap, add a expression to date1 column in the output table:
row1.date1==null||row1.date1.equals("")?"default value":row1.date1
this expression assign a default value to the column if it is null or empty value.
Ya @Shicong Hong , i write the above expression i can get the null value but the 3rd record itself is not coming in the output while i normalize date1
i will be having 2 files after using normalize component one file for date1 and second file for date2
when i join these 2 files the dates are not getting correctly displayed
something like below am getting
Thanks in advance,
lmit
It is better to add a sequence id for each row after tNormalize, the sequence id will be the join key when you join the data back.
Hi @Shicong Hong , thanks a lot for responses
i tried with sequence id also but am not getting the 3 records for date1
for date1 2 seq id is getting generated and for date2 3 seq id
when looking up and getting 3 records but getting data either unique match or first match record
if I select all matches getting too many duplicate records and data is not getting populated correctly
thanks
lmit
set date2 as main flow and date1 as lookup flow, do an left outer join based on seq id.