Linq query to update column value based on another column

Hi Everyone,

If Data table column (“Account Number”) is any one the number mentioned below, then bot needs to update (“Category”) Column as " Success"

Note – The new account number may be added based on business needs.
30653
33819
38474
47008

Kindly, help me on providing solution to this scenario.

Thanks

A simple For Each Row in Data Table will do it.

  • For Each Row in Data Table
    – If {“30653”,“33819”,“38474”,“47008”}.Contains CurrentRow(“Account Number”).ToString
    — Assign CurrentRow(“Category”) = “Success”

Hi @nithya

=> Read Range Workbook
image
Output → dt

=> Use below syntax in Assign:

accountNumbers = New List(Of String)() From {"30653", "33819", "38474", "47008"}

accountNumbers is of DataType System.Collections.Generic.List(System.String)

=> Use below code in Invoke Code:

yourDataTable.AsEnumerable().ToList().ForEach(Sub(row) If accountNumbers.Contains(row("Account Number").ToString()) Then row("Category") = "Success")

Invoke Arguments:

=> Write Range Workbook dt back to excel.
image

FLOW:

XAML:
Sequence88.xaml (8.8 KB)

Regards