Hello,
I have a sequence that sums a data table column after filtering it based on values in two of its columns. This sequence works fine when there’s a value after the filter, but I also need it to work if there’s no value.
How do I get this to work?
My code is below (assign #1 is where the fault happens when there’s no value based on the filter)
Assign #1 (Filtering Data Table):
dt2 = dt1.Select("[Column 1] in (‘abc’) and [Column 2] in (‘xyz’) ").CopyToDataTable
Assign #2 (Summing Column from filtered DT):
dt3 = dt2.AsEnumerable.Sum(Function (x) If(Double.TryParse(x.item(“Column 3”).ToString, Nothing), Double.Parse(x.Item(“Column 3”).ToString), 0))