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.
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
I was just now looking for such activity
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.
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.
I see… I still don’t get the point 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
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.
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.
I suggest cosmetic revision.
Please, make visualisation of block “Else” in the Activity “If” optional.
Yes! That’s something me and our team thought of some time ago and would definitely be an improvement.
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.
Yes, definetely You are right - addition of just “If true” activity would be best solution for compatibility!
Welcome to our UiPath Forum!
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
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.
For this you can just use
Flow decision activity which is working as same as
If and looks better and take less space
A Flow Decision is used with Flowcharts. What I am talking about is the If Activity that is used in Sequences.
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.