Getting row number using dynamic way

Hello Team,
Please help me in getting row number using assign activity without for each row.
I have a table (extracted using activity “Extract Data Table”).
In that data table we want to check (Number of Rows )in which row with column 0 is having value “Lab” (given static value). so that we can remove top given row .

Hi @Aditi0374

RowIndex = (From row In dt.AsEnumerable()
 Where row(0).ToString = "Lab"
 Select dt.Rows.IndexOf(row)).FirstOrDefault()

Regards,

Assign Activity
idxRow | DataType: Int32 =

YourDataTableVar.ToList().FindIndex(Function (x) x(0).toString.Trim.ToUpper.Equals("LAB"))

it will return the 0based found row index (first occurence) OR
-1 when not found

If Activity | Condition: idxRow > -1

  • Then: Assign Activity: dtCleansed =
    YourDataTableVar.AsEnumerable.Skip(idxRow).CopyToDataTable

@Aditi0374

In addition to above we can also achieve this by using Remove Data Row actiivty

Regards,

what is the value in assign activity “rowIndex”

@Aditi0374

(From row In dt.AsEnumerable()
 Where row(0).ToString = "Lab"
 Select dt.Rows.IndexOf(row)).FirstOrDefault()