How to trim all the data in column to certain Limit

Hello All,
we want to keep first 80 characters of data in a column and trim rest of character. Kindly provide Logical query for same

Hi @Ripusudan_Sharma did u mean u need only 80 characters in each cell of that column as final?

@Ripusudan_Sharma
iterate over the datatable with a for each row activity

use an assign activity
leftside: row(YourColNameOrIndex)
right side: new String(row(YourColNameOrIndex).toString.Take(80).toArray)

in case of your string is shorter then 80 chars the statement will work and not fail instead of using substring method on a string having less then 80 chars

Hi @Ripusudan_Sharma

Please check the workflow

process1.zip (605.0 KB)

I had made the workflow to trim upto 10 characters.

You can make change in that by replacing the code in invoke code as follows

dt1.AsEnumerable().ToList.ForEach(Sub(row) row(“Number”)=row(ColumnName).ToString.SubString(0,80))

Hope it helps you

Mark it as solution if it resolves ur query

Regards

Nived N

Happy Automation

1 Like

Thank you @NIVED_NAMBIAR for Solution :pray:

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.