"Conditional Activity" with only "Then"

image

Hi @Robson_Fernando

May I ask for some more details about this? An use case maybe? Currently you can leave the Else box empty and it will work like you proposed.

Thanks,
Viorela

1 Like

Itā€™s more related to code clean and organized. It leaves the ā€œelseā€ in blank waste the limited space that I can see on the screen. Itā€™s all about User Experience and clean code.

Itā€™s the same case for Keep Acitvity Panel Size

9 Likes

I was just now looking for such activity :slight_smile:

When we need to execute a block if a condition matches else need to skip it, as of now, we still use the one activity that is there in UI Path. This serves the purpose. But this activity will check the else part as well even though itā€™s not necessary for the flow. This includes an execution time.
It will be good if a if-only activity is added into the activity list.

1 Like

Hi @Madhavi

I am not sure I understand. If you are 100% certain that your condition will always return True, then you donā€™t need an IF condition at all.

Also, I think Else is only executed when the condition evaluates as False. At the very last, it serves as the perfect place to throw an exception if you need to be 100% sure that Then is always executed.

Hi,
I suppose @Madhavi means this "Conditional Activity" with only "Then" :slight_smile:
Cheers

I seeā€¦ I still donā€™t get the point :smiley: Wouldnā€™t you always want to log the exception when something is not as you expect it?

Either way, Iā€™ll merge your topic with the older one to keep the discussion together :slight_smile:

Actually, itā€™s one null check difference ā†’ see source here (lines 85-98). If activity hasnā€™t been changed in ages, so even though itā€™s newer source itā€™s still the same.
There is also a refactoring consideration - if at some point in the future you will need the Else branch, you canā€™t just fill it in, you have to recreate this part using the original If implementation.
Itā€™s UiPathā€™s call, but Iā€™d say this one is probably not worth it.

2 Likes

More to the actual point though, ā€˜related to code clean and organizedā€™
i agree some big efficiency gains if we can standardize the size of the activity block in workflow/diagram ui.

the varying sizes of the activity blocks in the workflow is very messy and the inability to resize is limiting / causes restraints on comparing code / reviewing / just plain looking at it.

2 Likes

I suggest cosmetic revision.
Please, make visualisation of block ā€œElseā€ in the Activity ā€œIfā€ optional.

6 Likes

Yes! Thatā€™s something me and our team thought of some time ago and would definitely be an improvement.

1 Like

I am not sure about the complexity of this, but UiPath could at least create an ā€œIf - Trueā€ activity with only the ā€œTrueā€ block. There are plenty of cenarios where it would be useful.
They already have redundant activities like ā€œDouble Click ā€¦ā€ that itā€™s the ā€œClick ā€¦ā€ activity with the value ā€œCLICK_DOUBLEā€ on ā€œClickTypeā€ property.

1 Like

Yes, definetely You are right - addition of just ā€œIf trueā€ activity would be best solution for compatibility!

2 Likes

Hi @user42

Welcome to our UiPath Forum! :slight_smile:

I merged your topic with the similar one to keep the discussion in one place.
Please see the comments in this topic for further insight. You can also vote up the feature :slight_smile:

1 Like

When using If Activities, it is not always the case that both sides, If and Else, are going to be filled out. The extra space thatā€™s taken up by either unused area generally looks bad, especially with increasingly nested blocks.

I propose that the Else case should not be visible by default and that it can be added if it is needed as this would be a cleaner approach. The If case should likely be always visible because the expression can be flipped using Not in order to change the logic such that it is used instead of the Else case.

2 Likes

Hi @dmccammond,
For this you can just use Flow decision activity which is working as same as If and looks better and take less space :wink:

A Flow Decision is used with Flowcharts. What I am talking about is the If Activity that is used in Sequences.

1 Like

Have you tried Switch activity then? Itā€™s almost the same and you have by default just one case for the expression.

While the Switch activity would allow for the usage of the entire width of the activity, I would argue against using it as that would make it harder for other developers to interpret and understand the code as they may understandably believe that there is something in the default case selector or that multiple options were intended but not utilized. This is not the same case with If statements in programming where conditional programming without an Else case is widely used and understood.

1 Like