Datatable query for update the column values

How to update one column based on other column
If one column is empty i need update the next column with certain value
Column A. ColumnB.

ColumnA. ColumnB

If column A is blank and columnB is blank or 0 need to update column B with value yes

Hello @Demo_User
First take add the column of output if it not present in the input datatable.then do for each activity and provide condition
String.isnullorempty(CurrentRow(0).tostring) or String.isnullorempty(CurrentRow(1).tostring)
assign - CurrentRow(outputColumn) = “Yes”
assign - CurrentRow(outputColumn) = “No”

Need a query

Hello @Demo_User ,

Try using this database query

Update YourTableName set [colB] = ‘Yes’ where [colA] is null and ([colB] is null or [colB] = 0)

Hi @Demo_User

Please use this query in the Invoke Code activity:

row("ColumnB") = If(row("ColumnA").ToString.Equals(String.Empty) OR row("ColumnB").ToString.Equals(String.Empty) OR row("ColumnA").ToString.Equals("0"),"Yes",row("ColumnB").ToString)
End Sub)

Arguments Panel for the Invoke code:

Hope this helps,
Best Regards.

1 Like

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