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

Highlighted
Seven Stars

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


Accepted Solutions
Highlighted
Sixteen Stars
Sixteen Stars

Re: 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

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

TRF

View solution in original post


All Replies
Highlighted
Sixteen Stars
Sixteen Stars

Re: 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

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

TRF

View solution in original post

Highlighted
Seven Stars

Re: 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

Thanks @TRF  Solution Worked!

2019 GARTNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

6 Ways to Start Utilizing Machine Learning with Amazon We Services and Talend

Look at6 ways to start utilizing Machine Learning with Amazon We Services and Talend

Blog

Downloads and Trials

Test drive Talend's enterprise products.

Downloads