Assign value/string to ColumnB based on value of ColumnA

Hi All,

I am looking for a way to dynamically assign a value to Column B based on the value of Column A.

Example: As long as the value of Column A <= 5, assign value A to Column B. Else, assign value B to Column B.

image

1 Like

Hi @calvin.tan

Give a try to this

2 Likes

Hi @calvin.tan

Please use this query:

io_dt.AsEnumerable.ToList.ForEach(Sub(row)
row("Column B") = If(CInt(row("Column A").ToString)<=5,"A","B")
End Sub)

Workflow:

Test4.xaml (8.4 KB)

Output:

image

2 Likes

HI,

Another approach:

dt.Columns("ColumnB").Expression = "IIF([ColumnA]<=5,'A','B')"

Regards,

4 Likes

Thanks! This was what I was looking for.

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