tMap use column length in expression

Highlighted
Seven Stars

tMap use column length in expression

Hi all,

 

is there any way to access the column length in the expression

please find the screenshot

Instead of numbers directly can i use the column length and if so can you please tell the syntax.

Thanks


Accepted Solutions
Ten Stars

Re: tMap use column length in expression


All Replies
Employee

Re: tMap use column length in expression

Unfortunately no, you cannot access that variable.

 

Also, from a code logic perspective, it does not work.

 

First of all, you need to understand that the length for datatype String is only enforced when writing to a database.  Talend will not truncate your string if you are writing to a file unless you do so.  

Hence, the actual length of the string can be:

- Shorter that the length you defined

- Longer than the length you defined

- exactly the length as you defined

 

Hence, in 2 out of 3 cases, your transformation logic will be wrong.  

You need to get the actual length of the string and pass that into your substring function.

 

Seven Stars

Re: tMap use column length in expression

This job is only to separate the substrings from string and so the length mentioned in the design will be fixed and as far as writing to database is concerned, it will be a new job using the output file of the previous job.

anyways, it means the value has to be entered manually, there is no way that we can get the length.
else is there any design that i can use to separate substrings from a string using somethig else than tMap which can reduce the manual effort ?
thanks

Ten Stars

Re: tMap use column length in expression

What’s New for Talend Spring ’19

Watch the recorded webinar!

Watch Now

Best Practices for Using Context Variables with Talend – Part 4

Pick up some tips and tricks with Context Variables

Blog

How Media Organizations Achieved Success with Data Integration

Learn how media organizations have achieved success with Data Integration

Read

Downloads and Trials

Test drive Talend's enterprise products.

Downloads