Filter and update Data Table

Hello,
I need to update sub remark and final remark ,using filter conditions on billing status,
for billing status=‘a’ ,update sub remark =comment 1 and final remark=comment 2
for billing status=‘b’ update sub remark =comment 3 and final remark=comment 4
for billing status=‘c’ update sub remark =comment 5 and final remark=comment 6
f1processed.xlsx (7.6 KB)

Thank You,
Vishal(upload://oNSX5mRQVHxHhSOROLECLaWpr0t.xlsx) (7.6 KB)

@ppr kindly help

have a check if it can be incorporated in the previous’ case for each row:

2 Likes

What is the maximum type of status possible in billing status column?
Example=- success, failed, pending - 3 types

Hi @iVishalNayak

You can do it in this way, use the below code in the invoke code activity

For Each row As DataRow In dtf1processed.Rows
If row(“billing status”).ToString() = “a” Then
row(“sub remark”)=“comment 1”
row(“final remark”)=“comment 2”
Else If row(“billing status”).ToString() = “b” Then
row(“sub remark”)=“comment 3”
row(“final remark”)=“comment 4”
Else If row(“billing status”).ToString() = “c” Then
row(“sub remark”)=“comment 5”
row(“final remark”)=“comment 6”
End If
Next

Thanks

1 Like

may be at max 10

hey @ppr do we have linq to update the values of each row , because for each will take time, it has many records around 20000

Thanks,
Vishal

@ppr
can we do that updating row(“H”) with values from vlookup using LINq and without for each
Thanks
Vishal

This works
Do u have any code for vlookup and update values
Thank You
Vishal

Hi @iVishalNayak

You can update the row using the below code

(From row In out_dtWorkBase.AsEnumerable()
Select dtWorkBaseClone.LoadDataRow(New Object() {
row.Field(Of String)(“cust_program”),
If(row.Field(Of String)(“cust_channel”).ToString,“Wholesale”,“WS”,If(row.Field(Of String)(“cust_channel”).ToString,“RPD”,“RPD”,If(row.Field(Of String)(“cust_channel”).ToString,“kat”,“KATs”,row.Field(Of String)(“channel”)))),
row.Field(Of Object)(“sales_qty_cbb”).ToString
},True)).CopyToDataTable()

Thanks
Sanjit

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