Truncating column values in a Modify Rowset task

Post any question you may have in regards to GoAnywhere MFT and let our talented support staff and other users assist you.
3 posts Page 1 of 1

jbeekman

Posts: 4
Joined: Thu Feb 18, 2016 9:16 am

Post by jbeekman » Fri Nov 04, 2016 9:26 am
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?

Support_Rick

Support Specialist
Posts: 592
Joined: Tue Jul 17, 2012 2:12 pm
Location: Phoenix, AZ

Post by Support_Rick » Tue Nov 29, 2016 5:27 pm
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.
Rick Elliott
Lead Solutions Consultant
(402) 944.4242
(800) 949-4696

jbeekman

Posts: 4
Joined: Thu Feb 18, 2016 9:16 am

Post by jbeekman » Wed Nov 30, 2016 7:05 am
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?
3 posts Page 1 of 1