FREE OutSystems Workshops - Build an OutSystems App in 1 hour | ENROLL NOW

OutSystems 101: Splitting the flow!

< Back to Blog

Does this flow look weird to you?

One common situation when people are taking the first steps in this awesome world of OutSystems is trying to use data that are out of scope.

In this article, we are going to explore some situations where maybe you will not get the results that you want!

#1 Splitting and converging

You can see an example of this is the situation shown in the image on the left.

If all the possible routes begin at the Start node, all of them need to pass through the ActionBefore. The output of that action will be available throughout the whole flow.

But if you try to use the output of the ActionLeft or ActionRight nodes, you won’t be able to use it after the flows converge on ActionAfter. And the reason is simple: we don’t know if that data will be available.

If you are coming from the left branch and then in the AssignCommon you have “var = ActionRight.Out”, the assign is trying to get a value that might be empty, and we don’t want to have an ambiguous situation like that in our action.

It is particularly important to have this in mind at Preparation. If you split the Preparation flow, add there a SQL query or an aggregate, and then try to use that data source on a widget, both will be available but the results might, once again, be empty.

#2 Debug without using the data

We are trying to fill a list using ListAppend, but using debug, we see that the previous elements of the list are being set to the default value, and only the last one is being kept.

Actually, everything is fine. If this list variable is not being used anywhere, the debugger doesn’t feel the need to worry about that data. This is called optimization. In a platform as huge as OutSystems, it needs to understand what data is important to spend resources on.

Don’t get tricked by the debugger :)

#3 Outside the Flow -> Outside the Scope

You may not find some data available if the node isn’t in a specific place of the flow.

In this example, if the assign node is not after the CreateUser, you can’t access the output of it. Be sure that you put the nodes in the correct place first!

#4 Don’t Make Shy Flows

A shy flow is a flow where you hide the logic.

One assign should just do one thing, the result could be the same, but your action will be easier to read!

There are many reasons for you to get different results for what you want. Keep calm, debug, and don’t be afraid to redo something.

Don’t be afraid to use the forums in the Outsystems Community page. There you may get a reply from one of ITUp’s MVPs, and we have four :)

Sources:

https://www.outsystems.com/learn/lesson/1829/logic-and-exception-handling

https://journal.highlandsolutions.com/tips-and-tricks-for-outsystems-documentation-422c51c87159

Turn Up Academy

Apply to our Turn Up Boot Camp

AND BECOME THE NEXT OUTSYSTEMS CERTIFIED DEVELOPER
(
Instructor
)

Latest Articles

Tech Bites - Should we validate form data on server-side?

Should we validate form data on server-side

When including forms in applications, developers often wonder if they need to re-validate data on the server side after having checked it on the client. Why go to the trouble of checking the data twice?

Tech Bites
The Top 5 Mistakes Handling Asynchronous Data In Outsystems Reactive Apps And How To Avoid Them

The Top 5 Mistakes Handling Asynchronous Data In Outsystems Reactive Apps

When developing an OutSystems reactive web app, you would expect to display data quickly, but it doesn't always happen. Do you know why? We'll explore the reasons and how to tackle them.

DevZone
Tech Bites - How to use Screen templates

How to use Screen templates

Did you know that the OutSystems Platform has tens of screen templates to help you quickly put together your apps? Let me show you how you can use them.

Tech Bites