Data Table String removal

Hi All,
I have a data table in which i am getting a string which is coming in any row in that data table.

So how can i find that string and can remove that row from the data table.

Kindly help me out.

Thanks
Taruna

see this @taruna.mehra

e.g. the below will replace any space in any column with NA and return the new datatable

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

Hi
Please use Lookup Data Table activity to find the row containing your value (specify the column which will contain the value)
image

And then using the Remove Data Row activity, remove that particular data row
image

Thanks,
Nishant

Hi, Is there any other removing that without LINQ method?

Actually am not from coding background so its hard for me to understand that.

1 Like

Hi Nishant,

If column name is dynamic then? I can apply this process?

Thanks
Taruna

Hi Jack

will that remove the row as well?

1 Like

Hi @taruna.mehra,
If the value can be present in ANY of the columns, then it is better to loop over all the rows and find the value within the row.
However if the column name is varying but not the index, then we can use the column index in the Lookup Data Table activity.

Thanks,
Nishant

Hi Nishant,

Its not working.

Thanks
Taruna

Hi Jack, Kindly share the process.Its deleted.

use this instead sorry @taruna.mehra

logic:
loop table in reverse, for each row look through all columns and find the strToFind, if found delete the row

exampleemail.xaml (14.0 KB)
test.xlsx (12.7 KB)

example (strToFind = “delete”)
image

result (result sheet)

Hi,
Can you do a RowIndex+1

Thanks,
Nishant

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