SONYC
(SONYC)
December 6, 2023, 8:49am
1
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.
sanjay3
(Sanjay)
December 6, 2023, 9:07am
2
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
SONYC
(SONYC)
December 6, 2023, 9:15am
3
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.
sanjay3
(Sanjay)
December 6, 2023, 9:29am
4
Hi @SONYC
In the activity where you are checking the null values for rows
after that activity you use IF activity for limits
SONYC
(SONYC)
December 6, 2023, 1:37pm
5
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.
system
(system)
Closed
December 9, 2023, 1:37pm
6
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.