ASSOCIATE-REACTIVE-DEVELOPER practice question 20 of 35

The following Screen (https://drive.google.com/file/d/1gm2xpbBQmEKTAHtCdj4wT0jNLnpDzZX/view?usp=sharing) has two Dropdowns, one to select a Country…

Full set: 262 questions
The following Screen (https://drive.google.com/file/d/1gm2xpbBQmEKTAHtCdj4wT0jNLnpDzZX/view?usp=sharing) has two Dropdowns, one to select a Country and one to select a City. The GetCountries and GetCities Aggregates provide the countries and the cities to be displayed in the respective dropdowns and are both set to be fetched At Start. Which of the following options is not a valid step if we want to just fetch the cities for the country selected in the respective dropdown?
Answer options
A: Set the Fetch property of the GetCities Aggregate to Only On Demand.
B: Refresh the GetCities Aggregate in the OnChange Action of the Country Dropdown.
C: Filter the GetCities Aggregate by the selected country.
D: Call the GetCities Aggregate in the GetCountries' On After Fetch Event handler. Correct answer
Correct Answer:
D. Call the GetCities Aggregate in the GetCountries' On After Fetch Event handler.
Explanation

The standard pattern for implementing cascading dropdowns in Outsystems Reactive Web Apps involves three key steps. First, the dependent data fetch (GetCities) must be set to Fetch: Only On Demand to prevent it from running on screen load. Second, a filter must be applied to this aggregate based on the variable bound to the primary dropdown (Country). Third, the OnChange event handler of the primary dropdown must execute a Refresh Data action targeting the dependent aggregate. Option D is incorrect because triggering the GetCities aggregate in the On After Fetch event of GetCountries would execute it at screen load, before the user has selected a country, which defeats the purpose of a cascading relationship.

Why Incorrect

A. Set the Fetch property of the GetCities Aggregate to Only On Demand. This is a required step to ensure the aggregate only runs when explicitly refreshed, not when the screen initially loads.
B. Refresh the GetCities Aggregate in the OnChange Action of the Country Dropdown. This is the correct mechanism to trigger the data fetch for cities after the user selects a country.
C. Filter the GetCities Aggregate by the selected country. This is essential to ensure the aggregate retrieves only the cities corresponding to the user's selection.

References

1. OutSystems Documentation, "Create a cascading dropdown": This guide explicitly outlines the correct procedure. It states, "Set the Fetch property of the Aggregate that gets the data for the second Dropdown to Only on demand." It also instructs to, "In the OnChange event of the first Dropdown, refresh the Aggregate that gets the data for the second Dropdown." This validates that options A, B, and C are correct steps.

Reference: OutSystems. (n.d.). Create a cascading dropdown. OutSystems Documentation. Retrieved from https://success.outsystems.com/documentation/11/developinganapplication/designui/patterns/usingtraditionalwebpatterns/controls/createacascadingdropdown/ (Note: While the URL mentions Traditional Web, the pattern and properties like Fetch: Only On Demand and OnChange are identical and fundamental in Reactive Web).

2. OutSystems Documentation, "Fetch and display data from the database": This document details the Fetch property of Aggregates. It explains that At Start fetches data when the Screen loads, while Only on demand means the data is fetched only when explicitly requested via a Refresh Data action. This supports why option A is a necessary step.

Reference: OutSystems. (n.d.). Fetch and display data from the database. OutSystems Documentation. See section on "Data Fetching Logic".

3. OutSystems Documentation, "Screen and Block Lifecycle Events": This document explains the On After Fetch event for data fetches. It clarifies that this event runs "after the data Fetch Action is executed." For an aggregate set to Fetch: At Start like GetCountries, its On After Fetch runs during the screen's initial load, which is the incorrect time to fetch dependent data based on user input.

Reference: OutSystems. (n.d.). Screen and Block Lifecycle Events. OutSystems Documentation. See section on "Data Fetch Events".

Scroll to Top