One Star

[resolved] empty string to null for all string fields

I am working with data many hundreds of fields wide.  For every string field I need to convert empty string "" to null.  I can do this field by field with a tMap or tReplace component but it is tedious to set the transformation for each field when there are hundreds of them.
Is there a way to do this where I don't need to specify each field.  Like a "perform this transformation for all fields" capability?
1 ACCEPTED SOLUTION

Accepted Solutions
One Star

Re: [resolved] empty string to null for all string fields

That works.  I found that I needed to use advanced mode and replace with empty string rather then null.
pattern:  "\"\""
replace: ""
but I still need to get the field broken back out by schema.  In writing the file out and reading it back in with schema I found that just the defaults of the tFileOutputDelimited component would also remove the "".  So I can just read the file, write it out, and read it back in.  
2 REPLIES
Moderator

Re: [resolved] empty string to null for all string fields

Hi,
Have you tried to useTalendHelpCenter:tFileInputFullRow-->tReplace to replace all your empty string "" to null?
tFileInputFullRow can a file and reads it row by row and sends complete rows as defined in the Schema to the next Job component.
Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
One Star

Re: [resolved] empty string to null for all string fields

That works.  I found that I needed to use advanced mode and replace with empty string rather then null.
pattern:  "\"\""
replace: ""
but I still need to get the field broken back out by schema.  In writing the file out and reading it back in with schema I found that just the defaults of the tFileOutputDelimited component would also remove the "".  So I can just read the file, write it out, and read it back in.