Search data table ,if column0 starts with T then inject some formula at column 2,3,4 which will inlcude currentrowIndex

Search data table ,if column0 starts with T then inject some formula at column 2,3,4 which will inlcude currentrowIndex.
ex:-column0 column1column2column3column4
T-6789 xyz1 abcd1 yus1
57689
adbc
T-1234 xyz4 abcd4 yus4

i dont want to use for each row in datable activity .i want to use Linq for faster result.

Hi @neha.kumarief868 ,

dataTable.AsEnumerable().Where(r => r.Field<string>("column0").StartsWith("T")).Select(row =>
{
    row["column2"] = "formula1" + row.Table.Rows.IndexOf(row);
    row["column3"] = "formula2" + row.Table.Rows.IndexOf(row);
    row["column4"] = "formula3" + row.Table.Rows.IndexOf(row);
    return row;
}).ToList();

how can i implement this in UiPath.

Hi @neha.kumarief868 ,

You could also try making use of combination of For Each and Linq approach in the below way :

image

We Filter the Datatable to get rows which has starting letter as T in it’s first column and then iterate only through those rows and update it.

Visuals :
Before Updation :
image

After Updation :
image

Let us know if this doesn’t work.

2 Likes

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