How to filter the Age less than 180 where age is in range format like 0-30,31-60,61-90,91-180,181-365,366-730,>730,not due
How to filter the Age less than 180 where age is in range format like 0-30,31-60,61-90,91-180, so on
Hi @anjani_priya ,
can you provide the sample input and expected output.
Regards,
Arivu
Hi @anjani_priya ,
Could you please provide some more context to look into it please?. Thanks!
Hi @anjani_priya
Assumption: you are comparing with 180 or any of the Upper Limit in the range input.
Here is one approach:
The Logic:
Step 1: Using Regex, extract the lower limit of the Age. (extracting the Higher limit will work in cases “<=”, “>=” and “>” 180, Because you mentioned only “less than” and not “less than equal”, i must take the lower limit otherwise it’ll fail for input 91-180)
lowerAge = System.Text.RegularExpressions.Regex.Match(inputAge, "\d{1,3}(?=-)|(?<=>)\d{1,3}").Value
Step 2: Using the following “Else If” logic, we will handle the cases for “<180”, “>180” and “not due”:
If Not String.IsNullOrEmpty(lowerAge) AndAlso CInt(lowerAge) < 180, then:
'''Your process for <180'''
Else If Not String.IsNullOrEmpty(lowerAge) AndAlso CInt(lowerAge) > 180, Then
'''Your Process for >180'''
Else
'''Your Process for No Due'''
The “AndAlso” is used to handle the empty string returned by regex for the “no due” cases.
The Output:
Case 1:
Case 2:
Case 3:
Case 4:
Case 5:
If this solves your issue, do mark it as a solution
Happy Automation
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.