Hi All,
In my project I have used Regex and in output an innumerable variable it is returning. I want to conditionalize my code, if that innumerable variable is returning null value or not. Can anyone help me to do that.
E.g.
Innumerable Variable = X
I am checking with condition in if statement → X(0).ToString = “”
And X(0).ToString = null
my code is getting stopped every time with this condition.
Thanks,
Baruna K Panda
ppr
(Peter Preuss)
November 14, 2022, 10:22am
2
Lets assume you have an IEnumerable(Of Match) - myMatches
Check: myMatches is null we do check - isNothing(myMatches)
Check: myMatches is returned but did not have matches - myMatches.Any()
Hi ppr,
I tried as you suggested, but it is working fine for variable having value, but getting failed for variable returning null.
I have given if condition, it is getting away. Pleas refer the attached images for your reference.
Thanks
ppr
(Peter Preuss)
November 14, 2022, 10:48am
4
In general we do prototype / check our ideas within immediate panel:
Understanding the 6 Debugging Panels of UiPath in the easiest way possible! - News / Tutorials - UiPath Community Forum
we can compose a needed construct from following building blocks:
Check if myMatches was returned with matches:
myMatches.Any()
Check if e.g. the access to a particular index is available or not:
isNothing(myMatches.ElementAtOrDefault(1))
Also have a look here:
Case - not matches found:
Case - match was found checking first()
But there is no second match:
where the long constructs for the dedicated element acces check can be simplified to:
with the meaning true: does not exist
hi @Panda_Baruna_K
You can try like this
Innumerable Variable.Count=0
Regards
Sudharsan
1 Like