GitHub user dmainou added a comment to the discussion: Truncate data as per 
field size using Select values

Ok. 
Start by creating a unit test that proves the current and desired behaviour 
(then use this to validate correct working pipelines at every upgrade)

Use the calculator step to:
1 return the length of the field, 
2 add a constant  with the max  number of characters
3 calc the difference
Use the JS or UDJC steps to cut your string to length.
Validate this method takes into consideration carriage returns.

If it doesn't work you are going to have to replace the carriage returns with 
something else, count that something else repeat the above and then replace the 
something else  with carriage returns

Add a feature request ticket to enhance the strings cut step to enable cutting 
to length based on a column rather than a hardcoded value. Add a second ticket 
that enables handling of carriage returns.

GitHub link: 
https://github.com/apache/hop/discussions/5467#discussioncomment-15080045

----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: [email protected]

Reply via email to