Check if all values (Of Double) of a data column are in between limits

Hello,

I have a Data Table containing a bunch of columns where I need to check that the value is null for all rows. For this I use the expression below
In order to check that the value is null I use the expression bellow within a for each loop (on column headers array)

dtData.AsEnumerable().All(Function(x) Double.Parse(x.Field(Of String)(header)).Equals(0.00))

In the same DataTable I need to check for other columns that the values of al the rows are in between limits (like -0.50 and 0.50).

Thanks.

Hi @SONYC

Create Two variable (Variable Type=Double)

lowerLimit = -0.50
upperLimit= 0.50

Use If Activity
Condition

currentItem >= lowerLimit AndAlso currentItem <= upperLimit

Hope this helps

Thank you @sanjay3
I this case I have to use two nested loops and an If activity, then break in case of False.
I’d like to do check all the rows at once for each column.

Hi @SONYC

In the activity where you are checking the null values for rows
after that activity you use IF activity for limits

It works exactly as expected in one shot check. Please find the expression below if you encounter the same scenario.

dtData.AsEnumerable().All(Function(x) Double.Parse(x.Field(Of String)(header)) > (-1*0.5) And Double.Parse(x.Field(Of String)(header)) < 0.5)

If the limit value is variable it’s recommanded to store the value in a variable (Of Double) format and integrate the variable as below

dtData.AsEnumerable().All(Function(x) Double.Parse(x.Field(Of String)(header)) > (-1*limitValue) And Double.Parse(x.Field(Of String)(header)) < limitValue)

The expression should be used inside a loop on arrayHraders containing the headers of columns to be checked.

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