How to pass 0 for empty cell in datatable?

how to pass 0 for empty cell in datatable
for this datatable …

name col 1 col 2 col 3 col 4 col 5 col 6
8-15 12 1
3-7 9 3 3 1
1-3 27 15 7 2 7 4
Total 48 15 10 5 7 6

share your sequence file.

Hi @domsmgtmeet22

Try the below linq expression,

- Assign -> resultDataTable = (From row In dataTable.AsEnumerable()
                               Let newRow = row.ItemArray.Select(Function(cell) If(cell Is DBNull.Value OrElse String.IsNullOrEmpty(cell.ToString()), 0, cell)).ToArray()
                              Select dataTable.Rows.Add(newRow)).CopyToDataTable()

Hope it helps!!

this code is replicate error share you sequence file.

Hi @domsmgtmeet22

You can use this code

Please find attached the Sequence.
UpdateTable.zip (10.7 KB)

Hope this helps :slight_smile:

hi @domsmgtmeet22 sounds like that’s what you need.

Replace null values with 0 from a data table column using LINQ - Help / Studio - UiPath Community Forum