Selection lists are a commonly used component in data entry applications, in this blog we share a couple of tips on how to better work with these list of values in specific scenarios. While defining a list is quite easy using the "add data" quick start, in some cases you might want to get the data into the list in a different way.
The default "Add Data" quick start creates a ServiceDataProvider (SDP) variable that populates your list. The SDP is defined at the page level, and manages the interaction with the backend REST data source automatically for you. The SDP uses pagination returning initially a limited number of records. It relies on the backend supporting pagination to fetch more records as the user scrolls down the list. It also relies on the backend REST service to do filtering of records when you type to search a value in the list. This approach is ideal if you have quite a large set of records or in cases where the values in that list are changing frequently (new records being added or deleted).
But in cases where the list you are selecting from has a limited number of records, or in cases where the list is not changing frequently – it might be better to base your selectSingle on an ArrayDataProvider (ADP) instead of SDP to allow you finer control over the REST interactions.
In the demo below we show how ot use an ADP to store the list of values at the application level and fetch the whole set of records only once. Because the list is stored at the application scope, you can use the same list in multiple pages in your app without the need to refetch the records each time. This also means that filtering the list will be a client side operation without a new call to the backend.
At the end of the demo we also show you how you can access other data about the row you selected from the list – this allows you to eliminate a separate call to another REST service to get that additional data. Since the data is already on the client we can use the Value-Item property of the selectSingle to access it through the data object.
Overall using the above approach for LOVs in SelectSingle can result in better performance for cases where you have limited number of records (a few hundred max) and when that list is not changing frequently – so doesn't require a frequent refresh of the values you can select from.
For more examples and advanced capabilities of the selectSingle component check the Oracle Visual Builder Cookbook samples.
