Go to different FlowChart/Sequence

studio

#1

Hello my colleagues,

I have already raised this question before, but as I find this as the most crucial, I will have to ask again.

Is UiPath capable of going somewhere else, meaning not continuing in the current flow/sequence or for instance skip few flowcharts? Or getting back to the beginning?

There are always possibilities like designing the flowchart that way that the crucial decision are in the main flowchart but if you want to change the flow inside the sequence there is no option to link the condition outside the sequence (or flowchart)


Differences between the type of processes in UiPath
#2

Hi,

Yes absolutely. By skipping a few flowcharts i presume you mean not executing certain activities based on some condition?
You can achieve this by using a flowdecision or an if activity.

I believe that sequences, flowcharts and state machines will provide you with the logic you need.
However, if you have a question about how to achieve certain behavior, please specify your issue and upload your current solution.


#3

I dont know how to be more specific…Of course I dont mean basic if or flow decision :frowning:


#4

I prepared a workflow for demonstration.

If you open flowchart 2, inside it open sequence 1 and after click 1 there is IF. If a condition is met I want him to go to flowchart 1 again…that is my question.

test.xaml (16.0 KB)


#5

Hi Mario!

Unfortunately I am on my work computer so I am unable to download your demonstration file. I think I understand what you’re asking, though. UIPath provides a third, lesser-known workflow (besides Sequences and Flowcharts) called State Machines that I think might be able to solve your problem. I know I was also frustrated by the limitations of Sequences and Flowcharts at one point, and State Machines really changed my way of thinking about how I program in UIPath.

I like to think of State Machines as kind of Flowchart with a built in “Switch” activity (but more powerful than either of the two alone). There is surprisingly little training information I have been able to find online regarding State Machines (although you’ll be able to find some here on the forum), so you will have to do some experimenting for yourself to figure out exactly how they work. (This page helps explain the basics of State Machine mechanics: https://studio.uipath.com/v2017.1/docs/state-machines.) For your particular situation, I expect you might want to put Flowcharts directly inside your States and then use Flow Decisions to push the robot out of the State if you encounter different situations.

I have attached a sample project in which I attempt to demonstrate the power of State Machines and how you might be able to use it in your situation. (The most important parts are in State2 and the State2 conditions.) Please let me know if this is helpful!

Best of luck,
Riley

Attached sample program:
State Machine Demonstration.xaml (20.8 KB)


#6

Thank you for your example.

Still I dont think it will solve my problem. So far I have the robot which is designed in similar way. Simply said, all the flow decision are exactly where they need to be to continue in the right way when a condition is met.

Same as in your example. I chosed one of the options in state2 but still it has to continue to the next steps (decision in our case, what if there is a sequence which I dont want to go through after a condition).


#7

Hi Mario!

This may still not be exactly what you need, but allow me to clarify how I was thinking you could use State Machines to simulate the “skip sequences the process no longer needs to run through” situation you are describing. I mentioned in my original response that:

To expand on this, it is not so much the State Machine by itself, but rather the State Machine in combination with the Flowchart inside it that I believe will make what you’re asking possible. For instance, please see my updated project example. This is an “expanded” version of my original example (to more precisely address your problem rather than just explain how State Machines work in general): State Machine Demonstration.xaml (43.3 KB)

Here’s a screenshot of the Flowchart within one of the States in my example, for anyone who doesn’t want to open up the project:

The highlighted activities here represent sequences you may or may not want the robot to skip if it encounters different situations. So, say your robot is running along and it hits something in Sequence 2 that means that you no longer need it to run through Sequences 3 or 4. You could just have a Boolean variable within the State scope called “QuitState”, which you assign to “True” when the robot encounters that situation. This could then immediately push the robot out of State2 when it reaches the Decision Tree between Sequence 2 and Sequence 3 (since the “False” arrow for the Decision Tree isn’t leading to any additional activities). Finally, you could have a single Transition arrow exiting State2 that leads to State3, which would mean that you wouldn’t even have to set a condition for the Transition since there is only one possible path for the robot to follow.

In this situation, State3 could be where you wanted your robot to pick up again after potentially skipping the remaining steps in State2. – The robot will continue on with the steps in State3 both (A) if it encounters a situation that makes it exit State2 early, or (B) if it runs all the way through State2 successfully.

Let me know if this is more helpful!

Cheers,
Riley


#8

Hi,

There is one really important part you just said:…”once it hits decision tree between seq 2 and 3…” and that is exactly the problem. Still it will have to finish everything between the decision tree and the condition which was hit. There can be a lot of activities in sequence 2…is that clear?


#9

Hi Mario,

Yes, that makes sense. If you are containing “a lot of activities” within single sequences it can get very complicated trying to pull errors or anything else to the “outermost” layer of your process. In my experience, sequences are a very basic building block that should only be used for the very smallest, simplest pieces of your workflow. The majority of things should be contained in flowcharts, as these do provide an easy way (decision trees without a continuation in one of the branches) to “exit” up to the next workflow level. (Your original post seemed to postulate the question as you needing some way to continue with the process whether that was in a flowchart, sequence, or something else. If you are specifically limiting the situation to sequences, that changes things.)

On the whole, I would still recommend moving important pieces of your project (such as these situations where there could be errors that require alternative loops) into flowcharts where these situations can be handled better rather than confining them to sequences. That being said, another option for you would be putting your “problem” sequences inside of TryCatch activities and then using custom “Throw” activities to boot the sequence out to the TryCatch level whenever an error is encountered.

Please see my screenshot example below and let me know if you have any questions:

(Note: The Expression Editor in my screenshot is displaying what type of error I have specified the “Throw” activity to throw when an error is encountered. As a result, this is the type of error I have designated in the Catches section of the “TryCatch” activity. You could obvious change the thrown/catched error in your situation if you wanted to – just make sure they match.)

Cheers,
Riley