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

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Tmap insert ' ' to a string

Hi There,

First of all I'm a total newbie to Talend and java so please excuse me if my issue seems very primitive 0683p000009MACn.png Anyway my issue is that I'm stuck with figuring out how to insert '' around a string which is red and loaded to tmap from a CSV file. Where it gets complicated is that if the field is null (meaning the column is empty) then the empty column output value should be replaced with null  (as in a string that says null) with out the ' '  around it but if it contains a string, output should be 'string'

 

basically IF column contains a string modify output to 'string'

else modify output to null(string)


so far i have figured out how to check for empty field and insert null by doing

row2.MailingAddressLine1.equals("")?"null":row2.MailingAddressLine1 < this does what i want to do regarding inserting null in to the field

 

And I have tried to do the double quote insertion by doing

StringHandling.TRIM(row2.MailingAddressLine1).length() != 0 ? " 'row2.MailingAddressLine1' ":row2.MailingAddressLine1 < this just replaced 'row2.MailingAddressLine1' for anything that contained a valid string in that column.

 

Have no clue as to how i should combine the two functions in to one maybe and if else statement?

 

Thank you for taking time to read! really appreciate your comments

 

 

 

Labels (4)
1 Solution

Accepted Solutions
TRF
Champion II
Champion II

Hi,

 

Try this:

row2.MailingAddressLine1.equals("")?"null":"'"+row2.MailingAddressLine1+"'"

or this, if you want double quotes arround the string:

row2.MailingAddressLine1.equals("")?"null":"\""+row2.MailingAddressLine1+"\""

View solution in original post

3 Replies
TRF
Champion II
Champion II

Hi,

 

Try this:

row2.MailingAddressLine1.equals("")?"null":"'"+row2.MailingAddressLine1+"'"

or this, if you want double quotes arround the string:

row2.MailingAddressLine1.equals("")?"null":"\""+row2.MailingAddressLine1+"\""
Anonymous
Not applicable
Author

Thank you so much, That just worked like a charm!

pawe84
Creator
Creator

Nice thanks but if I compared it to the csv option in the FileOutDelimited component now inside my description text the double quote won't be shown, e.g. you open the csv in excel again.

Inside the string must be wheel size 16"" but if I open the csv in notepad there's only size 16" thats why excel will not recognize the double quote in the description text.