ASSOCIATE-REACTIVE-DEVELOPER practice question 3 of 35

Which event is needed if we do some logic over the result such as checking if it is empty?

Full set: 262 questions
Answer options
A: Ready
B: Render
C: Destroy
D: After Fetch Correct answer
Correct Answer:
D. After Fetch
Explanation

The After Fetch event is a specific handler for Aggregates and Data Actions that executes immediately after the data fetch successfully completes. This is the designated and most efficient place to implement logic that processes the fetched data, such as checking if the returned list is empty, manipulating the data, or assigning results to other variables. Using this event ensures the logic only runs when new data is available and ready for inspection.

Why Incorrect

A. Ready: The OnReady event runs only once when a Screen or Block is initialized. It is used for initial setup, not for processing the results of a data fetch which happens asynchronously.
B. Render: The OnRender event runs after every time a Screen or Block is rendered or re-rendered. Placing data processing logic here is incorrect and inefficient as it would execute on every UI update.
C. Destroy: The OnDestroy event is for cleanup logic and runs just before a Screen or Block is removed from the DOM. It is not suitable for processing fetched data.

References

1. OutSystems Documentation - Fetch data on a Screen: In the section "Process the results of a fetch," it states, "To process the results from an Aggregate or a Data Action, select the fetch in the Screen and add the On After Fetch event handler... The logic in the On After Fetch event runs after the data fetch." This directly supports using After Fetch to check results.

Source: OutSystems. (n.d.). Fetch data on a Screen. OutSystems Documentation. Retrieved from https://success.outsystems.com/documentation/11/developinganapplication/designui/logic/fetchdataonascreen/

2. OutSystems Documentation - Screen and Block Lifecycle Events: This document describes the purpose of OnReady, OnRender, and OnDestroy events. It clarifies that OnReady is for initialization, OnRender for DOM updates post-render, and OnDestroy for cleanup, none of which are intended for processing data fetch results.

Source: OutSystems. (n.d.). Screen and Block Lifecycle Events. OutSystems Documentation. Retrieved from https://success.outsystems.com/documentation/11/developinganapplication/designui/screens/screenandblocklifecycleevents/

3. OutSystems Documentation - Data Action: This page explains that a Data Action has an OnAfterFetch event property. This event handler is "executed after the Data Action's fetch is completed," confirming its role in post-fetch processing.

Source: OutSystems. (n.d.). Data Action. OutSystems Documentation. Retrieved from https://success.outsystems.com/documentation/11/reference/servicestudioreference/logic/dataactions/

Scroll to Top