IF block using conditional activity instead

It would be great if you could have IF blocks where you just add an activity that outputs true or false instead of saving the value in a variable and then writing it in the statement. Just like the Retry activity where you can add an Element Exists as Condition.

Something like this for instance:

tempsnip

There is nothing like this, right? This way of working (putting activities inside each other) could save a lot of time and variable creating in many places and would be a more swift way of building. As a complement, of course. Not to replace the normal statements used as conditions.

Hi @vincera,
You can always use native VB.net or C# method like this:
image

image

2 Likes

Hi!

Yes, of course. Forgot that one. Perhaps a bad example.

What about Element Exists instead? Are there other better ways than to add this and save result in a variable?

BR

David

For Element Exist it’s more tricky as it is based on Computer Vision mechanism which is using OCR so this can’t be just used directly in IF statement (which is not CV-based). Instead you need firstly end CV scope which will generate output variable/argument of boolean type which can be used in IF statement.

I’m not referring to the CV version, just the normal Element Exists:

image001.png

How would that work?

Sorry I forgot about this standard version of this activity as it’s not visible in Modern Design option :slight_smile:
Well, these kind of activities are Selector/UiElement-based so in other words are not usable in terms of vb.net or C# native method. In fact it might be a good idea for what you mentioned but how would you see possibility of using condition then? If for example IF statement would work with conditional activity we would need to somehow allow for manual conditions as well. How would you solve this to be let’s say more user friendly than it is now? :slight_smile:

Don’t get me wrong. I do like the idea but we need also think about other aspects in case somebody would need to use something what is not defined by available activity.

1 Like

I can think of three different approaches and this is the order I would rate them myself. The third one is not really a good option and definitely not backwards compatible.

  1. Keep only one type of IF activity but add support for both types. You can write expressions, or add activities. (text or markers needs to explain you can only use one of them but you have other activities with overlapping properties)

Full size version…
image

Compact version:
image

  1. Add a second type of IF-activity that only supports other activities as input (“Activity IF” or something…)
    image

  2. Keep only one type of IF activity but restrict it to conditional activities only and let users add expressions using IsTrue/isFalse activities (not sure about the name) that can be added throw a windows package.

image

1 Like

My comments disappeared when mailing in the reply so I added them above.

Image was also inserted in wrong order. Hope it’s right now :slight_smile:

It looks really interesting! I can’t promise anything as the process is more complicated and Studio is now using Modern Design activities which have quite different mechanisms but let me push this to our internal tracker :slight_smile: Thank you for really nice image examples!

No worries, thanks for listening! :blush:

1 Like

If you use the Element Exists from Ui Automation Next, that is “Check App State”, it’s like what you want

1 Like

Thanks Marcelo!

1 Like

Yup it’s exactly what I mentioned. Modern Design settings enables some new activities which are working differently. But the main difference is that you need to put such activity additionally into Use Application or Use Browser activity.

1 Like

To work with what @mmcruzRPA mentioned you can go to project settings from Project tab and set this option:
image

1 Like

Thank you. I guess “non modern” project versions will still be used for a while so adding what I proposed is still good.

1 Like

@pablito, David’s idea is spectacular.

Activities that return true/false could be put into the condition of an IF - this is like the Condition block in Retry Scope.

image

There are a lot of activities that return true/false that don’t even work in the Retry Condition. It would be great if this were more standardized and applied to all true/false activities, and applicable in IF conditions, Retry conditions, and any other place you can think of :slight_smile:

You could go even farther and do it with activities that have other return types, like Get Text. I could use Get Text to retrieve the text from an object, and drop it right into a Switch:

Hi @vincera ,

You can find this feature on the Autossential.Activities package under the activity name “When Do”.

Autossential - RPA Component | UiPath Marketplace

Documentation of this activity:

When Do - Autossential