Find and replace activity in data table

Hello,

How can I find particular string and replace it into another string in the data table.

Thanks
Minal Patil

Hey!

could you please show us the input and expected output?

Regards,
NaNi

Hey @minal.patil If you know in which column the value is present. Then you can use lookup datatable activity.if the value is present then you can replace that particular value with the value you need and assign that to the datatable.
The output of the lookupdatatable activity will be the row index of the searching value if the value is there or if the value is not there the output will be -1
Thanks and Regards.
Sreejith…

run 1st time: find 12051 in data table and replace it into 12051_A.
so now value is 12051_A in data table.
if it’s run multiple time: find 12051 in string"12051_A" and replace into 12051_A, Not 12051_A_A

I don’t know column name/number

Hey!

Try this:

  1. Read excel - output - DtOut
  2. Take one for each row in data table pass the DtOut
  3. Take one if condition and pass the expression like this
CurrentRow("ColumnName").ToString.Trim.Equals("12051")

In then Block take one assign activity and pass the value like this

Assign ReplaceText = CurrentRow("ColumnName").ToString.Trim.Replace("12051","12051_A")

Use add data row and pass the rows in ArrayOfRows

Regards,
NaNi

you can use following syntax

(From r In DT_Data.AsEnumerable Let ra = r.ItemArray.Select(Function (x) x.ToString.Trim.Replace(" ",“NA”)).toArray() Select DT_Data.Rows.Add(ra)).CopyToDataTable()

I don’t know column name.

It’s not working.

Error: “Collection was modified; enumeration operation might not execute.”

Hi @minal.patil

  1. Use Excel process scope activity

  2. Use excel file activity

  3. Find and Replace activity

Regards
Gokul

In Client machine there no Microsoft Office installed.

Only use Data Table activities.

Can me give any example