Skip to main content
Announcements
Introducing a new Enhanced File Management feature in Qlik Cloud! GET THE DETAILS!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

How to NULL a value in a tMap Expression if it's over a certain character length. I need to trim values that are to long so the values don't truncate

Hello Team of Talend Experts,

 

I need the syntax for a tMap Expression using Java Script that will NULL a value if it's over a certain character length say 30 characters. Also leave the other values under 30 characters the same and it's just a 1 for 1 mapping for the rest of the values.

 

Some Java Script Syntax example would be greatly appreciated

Labels (3)
1 Solution

Accepted Solutions
TRF
Champion II
Champion II

On tMap right side use thé following expression for each concerned field:
row1.fieldname == null ||
row1.fieldname.length() > 30 ? null : row1.fieldname

View solution in original post

2 Replies
TRF
Champion II
Champion II

On tMap right side use thé following expression for each concerned field:
row1.fieldname == null ||
row1.fieldname.length() > 30 ? null : row1.fieldname
Anonymous
Not applicable
Author

Thanks @TRF  Solution Worked!