I need to Concat 3 columns and insert in a new column.
I have write a code for that, attaching below but the issue is the one of the 3 columns are having few blank rows and it is throwing an error.
What can be a solution for this?
For Each row In YourDataTable.Rows
column1Value As String = row(“Column1”).ToString
column2Value As String = row(“Column2”).ToString
column3Value As String = row(“Column3”).ToString
Check if any of the columns have a blank value
If Not String.IsNullOrWhiteSpace(column1Value) OrElse Not String.IsNullOrWhiteSpace(column2Value) OrElse Not String.IsNullOrWhiteSpace(column3Value) Then
Concatenate non-blank values and insert them into the new column
row("NewColumn") = $"{column1Value} {column2Value} {column3Value}".Trim()
End
Try the below following code in Invoke Code activity:
For Each row As DataRow In dt.Rows
Dim value39 As String = If(Not IsDBNull(row("Column39")), row("Column39").ToString(), String.Empty)
Dim value10 As String = If(Not IsDBNull(row("Column10")), row("Column10").ToString(), String.Empty)
Dim value11 As String = If(Not IsDBNull(row("Column11")), row("Column11").ToString(), String.Empty)
row("Column40") = String.Concat(value39, value10, value11)
Next