Compare column value and update the comment

Hi,
I have a data table DT1

DT1 :

image

I am using invoke code activity with following code :
DT1.AsEnumerable.ToList.ForEach(Sub(row)
row(“Comments”)= If(Math.Round(CDbl(row(“Amount”))) = Math.Round(CDbl(row(“AmountCalculated”))) And Math.Round(CDbl(row(“Amount2”))) = Math.Round(CDbl(row(“Amount2Calculated”))),“Verified”,“Please Check” )

the above code provides output as DT1.
I need a solution which compares (‘column B’ with ‘column C’) and (‘column D’ with ‘column E’) and if we compare any negative value with 0 (Ex : -19.23 with 0) the comment must be written as ‘Verified’ instead of ‘Please check’

Expected solution :
image

Thanks in advance

Try this.

DT1.AsEnumerable.ToList.ForEach(Sub(row) row(“Comments”)= If(Math.Round(CDbl(row(“Amount”))) = Math.Round(CDbl(row(“AmountCalculated”))) And Math.Round(CDbl(row(“Amount2”))) = Math.Round(CDbl(row(“Amount2Calculated”))) Or (CDbl(row(“Amount”))<0 And CDbl(row(“AmountCalculated”))=0) Or (CDbl(row(“Amount”))=0 And CDbl(row(“AmountCalculated”))<0) Or (CDbl(row(“Amount2”))<0 And CDbl(row(“Amount2Calculated”))=0) Or (CDbl(row(“Amount2”))=0 And CDbl(row(“Amount2Calculated”))<0)“Verified”,“Please Check” )

Hope it helps.

1 Like

thanks @Harshith_Adyanthaya , this works

1 Like

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