Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
i have tried below expression in tmap as per expectation i should get " null " as output in tmap test editor ..but getting "n" as output ...could you please clarify this...
Or try this way where the code is checking whether you are sending input itself as "null".
Relational.ISNULL(row1.data) || row1.data.trim().equals("")|| row1.data.trim().toLowerCase().equals("null")?null:row1.data.substring(0,1).toLowerCase()
But the caveat is that sending null as a string is a bad practice.
Warm Regards,
Nikhil Thampi
Please appreciate our Talend community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
@lavan524 ,that hole expression will return a single character ,let think this way you have null as string with that expression will return only n ,if you changed 1 to 3 it will return nul
Hi,
Please try like below.
Relational.ISNULL(row1.data) || row1.data.trim().equals("")?null:row1.data.substring(0,1).toLowerCase()
Warm Regards,
Nikhil Thampi
Please appreciate our Talend community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
i have tried this way but still getting same output
Hi,
Could you please print the input and output side by side to a tLogrow and share it with us? We would like to see the input data you are passing.
Warm Regards,
Nikhil Thampi
Please appreciate our Talend community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
@lavan524 ,do you understand my answer,if not for that column have null values as string which means "null" has took as for that column with your expression returns only one character for "null" data the first character is n,so thats why you see n
Actually i am trying to test expression in tmap test editor ...as per expectation by default value should be null and as per expression out put should be " null " but getting " n "
Relational.ISNULL(row1.S_Name_Indexed__c) || row1.S_Name_Indexed__c.trim().equals("")?null:row1.S_Name_Indexed__c.substring(0,1).toLowerCase()
@lavan524 ,if you want null then change this way.
Relational.ISNULL(row1.S_Name_Indexed__c) || row1.S_Name_Indexed__c.trim().equals("")?null:row1.S_Name_Indexed__c.substring(0,4).toLowerCase()
@manodwhb has already explained it.
You are trying to insert null as a string "null" or "Null" or "NULL". But as per java, if it has to consider a value as null, it should be empty like a black hole.
You cannot equate it with any value as string.
Warm Regards,
Nikhil Thampi
Please appreciate our Talend community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
Or try this way where the code is checking whether you are sending input itself as "null".
Relational.ISNULL(row1.data) || row1.data.trim().equals("")|| row1.data.trim().toLowerCase().equals("null")?null:row1.data.substring(0,1).toLowerCase()
But the caveat is that sending null as a string is a bad practice.
Warm Regards,
Nikhil Thampi
Please appreciate our Talend community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂