Configure multiple data sources in your data page and set parameters that determine which data source to use, so that your application gets the right data every time. By setting parameters in your data page, you eliminate the labor and maintenance cost of creating and maintaining hard-coded calls for data.
- Ensure that the data page for which you want to configure multiple data sources has parameters. For more information, see Use case: Referencing data in a data page by using parameters.
- Create When conditions and configure the parameters. Data pages use a When condition and the parameter values that the referencing page submits to determine what data to send back. For more information, see When Condition rules.
- In the navigation pane of Dev Studio, click Records.
- Expand the Data Model category, and then click Data Page.
- Click the name of a data page to open the page.
- To specify data sources for the data page, on the
Definition tab, in the Data
Sources section, click Add alternative
source for each data source that you want to add.The IF field is displayed above the first source in the list.
- In the IF field, identify the When condition
that evaluates whether the current reference to the data page requires
using the source identified in each row.If you add additional sources, the condition for each additional source is set as ELSE IF. You cannot use the same When condition for more than one source.
The condition for the final data source in the list is set as Otherwise. If all the preceding When conditions evaluate to false, the data page uses the final data source.
- Optional: To delete a source, click Delete item.You can delete all but one data source.
- Optional: To set the order in which the system checks whether the data sources should be used, click the left side of the data source to drag it higher or lower in the list.
Result: The data page is prepared to respond to references that are sent with parameter values by returning data designed for the needs of each reference. The data page can create a separate instance of itself on the clipboard for each time it is referenced with unique parameter values. Additionally, the data page can restrict the number of data page instances to one, so each new reference overwrites the data page instance on the clipboard.
- In the IF field, identify the When condition that evaluates whether the current reference to the data page requires using the source identified in each row.