Page 1 of 1

Truncating column values in a Modify Rowset task

Posted: Fri Nov 04, 2016 9:26 am
by jbeekman
In a project which follows the pattern Read CSV 1 -> Modify Rowset -> Write CSV 2, I am concatenating two fields from CSV 1 with a New Column in the Modify Rowset task, and I need to truncate the resulting string to 30 characters before writing to CSV 2.

I expected that setting the Modify Rowset task's Size parameter would truncate values in the rowset, but that doesn't seem to be the case. Setting the Size parameter to 30 doesn't seem to affect the output at all as values greater than 30 are still written to the output file. What is the purpose of the Size parameter?

I can make this work using the Substring Function, but I have to test for string length greater than 30 characters or the function errors, e.g.
Code: Select all
${If(Length(var) > 30,Substring(var,1,30),var)}
Is this the only way to truncate the column in the output?

Re: Truncating column values in a Modify Rowset task

Posted: Tue Nov 29, 2016 5:27 pm
by Support_Rick
If it needs to be truncated at the CSV 2 level, that's going to be your best bet for making sure it's less than 30 bytes in that Rowset. I would probably lean more toward taking the whole data into CSV 2 then writing to my final DB or output with the truncation there. I usually do it that way since it's easier to control for me.

Re: Truncating column values in a Modify Rowset task

Posted: Wed Nov 30, 2016 7:05 am
by jbeekman
Thank you, Rick. In this scenario CSV 2 is the final output of the project. I'm curious what the size parameter is used for in the Modify Rowset task, since it doesn't seem to be used for data truncation. Am I missing the point?