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.
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.
Baruna K Panda
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()
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.
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:
Check if e.g. the access to a particular index is available or not:
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
You can try like this