Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in NYC Sept 4th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
lmit
Creator II
Creator II

new line separator

Hi All,

I have a input file like below

0695b00000UxxijAAB.pngthe 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

0695b00000UxxkQAAR.pngThe 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

Labels (2)
11 Replies
Anonymous
Not applicable

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

 

lmit
Creator II
Creator II
Author

Hi @Shicong Hong​ , Thanks for the reply,

i mean if my date is like below

 

0695b00000Uy1eqAAB.pngand lets say my default value is abc , then my output should be like below

 

0695b00000Uy1f5AAB.pngThanks,

lmit

Anonymous
Not applicable

@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

lmit
Creator II
Creator II
Author

@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

Anonymous
Not applicable

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.

 

 

lmit
Creator II
Creator II
Author

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

 

 

0695b00000Uy2FNAAZ.pngThanks in advance,

lmit

Anonymous
Not applicable

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.

 

lmit
Creator II
Creator II
Author

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

Anonymous
Not applicable

set date2 as main flow and date1 as lookup flow, do an left outer join based on seq id.​