Hello,
I have a data table and I need to check every value of the column “Diff”.
Before checking the value I need to parse it to type double.
Then I have to check if all values are 0.00 and return true, else return false.
Could anyone provide an expression for this check ?
@SONYC assign this to boolean variable
dtData.AsEnumerable().All(Function(x) Double.Parse(x.Field(Of String)(“Diff”)).Equals(0,00))
if all values are 0 it will return true, else false
remember to put it in a try-catch block, in the catch block assign False to the variable. this is in case there are non-double values in Diff
Thank you @jack.chan
Since there might be values like 0.01 and -0.01, the sum will result to 0.00, but the check is false.
I need to make sure that All values are 0.00.
I’ve been using this expression which could work just fine for string type values:
dtData.AsEnumerable().All(Function(x) x(“Diff”).ToString =“0”)
The following expressions works perfect for double type values:
dtData.AsEnumerable().All(Function(x) Double.Parse(x.Field(Of String)(“Diff”)).Equals(0,00))
Just use Filter Data Table into a tempDT to remove rows where Diff not equal “0.00” then check the row count of tempDT
Thank you @postwick
Thanks to @jack.chan I managed to find the solution.
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.