Learn how the OutSystems Reactive Web If Widget evaluates a condition and displays either its true or false branch. See how functions can shape that condition, how each branch can hold several widgets, and when nested If Widgets help express more complex logic without adding branches to a single widget.

Multiple Choice

Which of the following regarding the If Widget is false?

The correct answer focuses on the limitation regarding the addition of branches to an If Widget in OutSystems. While it is true that more branches can be represented logically in an If Widget, there are constraints in terms of how many conditional branches can be effectively managed. In OutSystems, an If Widget typically allows for a simple structure that provides binary logic; that is, it will evaluate a single condition and then display one branch if true and another if false. Although you can create complex logic through nested If Widgets or by utilizing a different design, it's not accurate to say that you can arbitrarily add multiple distinct branches to a single If Widget. Each If Widget fundamentally operates on a single condition and presents two branches – one for true and one for false. Functions can indeed be used within the Condition of an If, allowing for dynamic evaluations based on runtime data. It's also correct that only one of the branches is displayed at any given time when the application is running, which is a foundational characteristic of conditional logic in programming. Likewise, it is permissible to incorporate multiple widgets within each branch of the If Widget, granting flexibility in what gets displayed depending on the evaluated condition. These aspects are essential for understanding the efficiency and structure of conditional rendering within the context of building

How Conditional Rendering Works in OutSystems Reactive Web Apps

A web page rarely shows the same thing to every person at every moment. A customer may see a “Continue” button while a form is complete, then see a message asking for missing details if it isn’t. In OutSystems Reactive Web, the If widget helps build these changes into a screen. It checks a condition and displays the content that fits the result.

The idea is simple, but it shapes how a reactive interface behaves. Once you understand the If widget’s two-branch structure, you can create clear, responsive screens without filling them with confusing logic.

One condition, two paths

An If widget evaluates a Boolean condition: an expression that resolves to either True or False. Based on that result, it displays one of two branches:

  • The True branch appears when the condition is true.

  • The False branch appears when the condition is false.

For example, a screen might check whether a user has entered an email address. If Email is not empty, the True branch could show a confirmation message. The False branch could display a prompt to enter an address.

This is a two-way choice, much like a fork in a path. The widget does not provide a row of separate branches for several different conditions. If an interface needs to respond to many possible states, you can combine If widgets, use another suitable control, or rethink how the screen presents those states.

That limitation is useful to keep in mind. A single If widget stays focused: one condition, one result or the other. It doesn’t become a general-purpose decision table just because the application has more cases to handle.

What goes into the Condition property?

The Condition property holds the expression the widget evaluates. It may refer to a variable, a screen input, an entity attribute, or a function. For instance, a condition could check whether a record exists, whether a number falls within a range, or whether a text field contains a value.

Functions can be used in a condition when they return a suitable Boolean result. A function might check whether a list has entries, or whether a date meets a rule. The key is that the expression must ultimately produce True or False; the If widget needs a clear answer before it can choose a branch.

As with any logic in an app, readability matters. A long condition packed with several comparisons may work, but it can be hard for another developer—or your future self—to understand at a glance. When a condition starts to look like a tangled set of cables behind a desk, consider using a well-named calculated value or simplifying the expression.

For example, a direct check such as IsFormValid is often easier to read in the widget than a long series of field-by-field comparisons. The underlying logic still needs to be sound, of course. A helpful name is a signpost, not a substitute for a correct calculation.

What happens at runtime?

When the screen runs, OutSystems evaluates the condition and renders the matching branch. Only one branch is shown at a time: True or False. If the condition changes as the app’s data changes, the displayed content can change too. That’s part of what makes reactive interfaces feel responsive.

Imagine a product page with a stock message. When StockQuantity > 0, the True branch can show “Available now.” When the quantity is zero, the False branch can show “Currently unavailable.” The message follows the data instead of relying on someone to update the page by hand.

This does not mean the If widget independently watches every possible change in the application. Its display depends on the expression and the reactive behavior of the values it uses. In normal screen development, when the relevant data changes, the interface can update to reflect that new state.

A useful design question is: what should a person see in each state? It’s easy to focus only on the condition and forget the experience around it. Clear text, sensible spacing, and an obvious next step can make a small conditional section feel polished rather than abrupt.

Each branch can hold more than one widget

A branch isn’t limited to a single element. You can place multiple widgets inside either the True or False branch. That might mean a heading, a short explanation, and a button all appear together when a condition is met.

For example, the True branch of an account-status check could contain a welcome message and a link to account settings. The False branch could include a notice and a sign-in button. Each branch acts like a small container for the content that belongs to that state.

This flexibility helps keep related elements together. Instead of showing and hiding each widget with separate conditions, one If widget can control a group of elements as a unit. That can make the screen structure easier to follow, especially when a message and its related action should always appear together.

Still, a branch filled with dozens of unrelated elements may be a signal that the screen needs a different structure. Grouping is helpful when the content belongs together; it’s less helpful when it hides a second, much larger page inside one conditional area.

When the logic needs more than two outcomes

Suppose a delivery status can be “Preparing,” “Shipped,” “Delivered,” or “Cancelled.” One If widget can’t directly provide four distinct branches. You could nest If widgets, but that can grow difficult to read if each new state adds another layer.

A sensible design may use a combination of conditional checks, a suitable switch-style control where available, or a small reusable UI element for each status. The right choice depends on the screen and the complexity of the rules. The goal is not to avoid all nesting; it’s to keep the logic easy to trace.

Nested If widgets can work well for a small number of related decisions. For instance, an outer condition might check whether a user is signed in, while an inner one checks whether the profile is complete. But if the structure begins to resemble a maze, pause and look for a clearer representation. A well-organized screen is easier to maintain and easier to explain to teammates.

A few habits that make If widgets clearer

Keep the condition focused on one decision. Give variables and calculated values names that describe what they mean, such as HasActiveSubscription or IsProfileComplete. Then make the content in each branch match that meaning.

Also consider the less obvious state. What appears if a list is empty? What does the screen show when data has not loaded yet? A False branch may represent several different situations, so a generic “No” message might not tell the user enough. If those situations need different messages, model them explicitly rather than expecting one Boolean condition to explain everything.

Finally, use the If widget for conditional display, not as a substitute for every kind of application logic. Keeping data rules, actions, and visual decisions in sensible places helps the screen remain readable as the app grows.

Small widget, important job

The If widget gives OutSystems Reactive Web developers a straightforward way to show one set of content or another. Its structure is deliberately simple: a condition, a True branch, and a False branch. The condition can use functions, and each branch can contain multiple widgets, but a single If widget does not provide an unlimited set of separate branches.

That basic shape is easy to work with once it becomes familiar. Use it for clear two-way decisions, and choose a different structure when the screen has several distinct states. A little care in how you express the logic can make an interface feel natural—and make the underlying app much easier to maintain.