Need Linq query- If the cell of "Column A" is blank then combine corresponding row with above row

Hi All,

I need a linq query for below scenario,
Sample data,

If the cell of “column A” is blank then combine corresponding row with above row.
Example: A4 cell is blank then combine 3rd row and 4th row.

Thanks in advance


you can use Invoke Code activity and use below code

For rowIndex As Integer = dt.Rows.Count - 1 To 1 Step -1
If String.IsNullOrEmpty(dt.Rows(rowIndex)(“Column A”).ToString()) Then
For colIndex As Integer = 0 To dt.Columns.Count - 1
dt.Rows(rowIndex - 1)(colIndex) = dt.Rows(rowIndex - 1)(colIndex).ToString() & " " & dt.Rows(rowIndex)(colIndex).ToString()
End If

check attach zip file (9.7 KB)

Hi @neha.upase,

Thank you so much for providing the answer.
It is working as expected.

Just to asking you
Is it not possible with linq query?


I tried the LINQ query, but unfortunately, it didn’t give the expected result. On the other hand, the above code works perfectly.

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