In this blog, we will cover the key points of difference between a Service Data Provider (SDP) and an Array Data Provider (ADP) by creating a VBCS application. So, let’s begin.
Requirements to perform the operation:
- Oracle Visual Builder Cloud Service (VBCS)
- Oracle SQL Developer
Real-time Array Data Provider (ADP) use cases:
- ADP also allows you control over the timing of data retrieval.
- Choose ADP when you need to customize data before presenting it in a table, especially if individual row editing on the screen is required.
- ADP keeps a copy of the data array that is accessible to clients. As a result, if you want to interact with the data to make changes, especially in the editable table, ADP is the best option.
- ADP gives you more options for populating and modifying data.
- By using ADP, calling an API user can fetch the data in the dropdown, this data can be manipulated/modified and then assigned to ADP.
- Bind hardcoded data to an ADP.
In an editable table using ArrayDataProvider (ADP), the user may alter particular column data and update it in the ATP table through a rest API, by refreshing the page, new data will appear in UI.
Create one variable whose type is “array of objects” and then we can use that variable in ADP under “bind data to variable”, by using this user is able to fetch the data automatically in dropdown without the use of any API/action chain when they run the application.
The below image shows “expenseArray” and usage of this array in “myExpensesADP” and those data is displayed in the dropdown.
“myExpensesADP” is the ADP used in below mentioned expenses type field.
The below image is related to editable functionality and delete action for selected columns.
ADP variable properties are different than SDP in VBCS. In ADP, we have two possibilities for assigning data, as shown in the image below. Moreover, unlike SDP, there are no parameters such as filter criteria, page criteria, or sort criteria in ADP.
Real-time Service Data Provider (SDP) use cases:
- SDP is very useful for providing pagination on a table or dropdown.
- SDP automatically fetches data when the associated UI component renders.
- There is no need to call an action chain to fetch the data in UI from database/BO/service connections.
- SDP offers default parameter options like Query, Filter, limit, offset, etc.
- By using SDP, the user can directly fetch the data into the dropdown, this data cannot be manipulated/modified in SDP once fetched.
In the below image, fetching data by using SDP and displayed in dropdown.
Pagination using Service Data Provider (SDP)
SDP automatically retrieves data when the relevant UI component renders, there is no requirement for an action chain to retrieve the data, even if it includes parameters such as filter criteria and sort criteria.
This allows the user to filter/sort the data based on their condition.
To understand the difference, let us create an Oracle VBCS application with a single page to showcase the difference between a Service Data Provider (SDP) and an Array Data Provider (ADP).
In the scope of this blog, we are using the Oracle REST Data Services (ORDS) connection to fetch data from the ATP database. The connection is already created.
Step 1: Let’s create the type for SDP (Service Data Provider).
Step 2: Create the type from endpoint.
Step 3: Define the type -name and whenever you are creating a data provider as SDP then create it from the endpoint Root which is shown in the image below.
Step 4: Create the variable by adding the earlier created type “getEmp”. Then, set the key attribute.
Step 5: Similarly, we are creating a type for ADP defining type name “getEmpData” and here we have not enabled the “create from endpoint Root”. This is a key difference between ADP and SDP.
Required fields are to be selected from items.
In ADP we can assign data in 2 ways:
a) Assign data later.
b) Bind Data to variable.
a) In Assign data later, we are adding item type from endpoint type, and to fetch data we need an event in this case ‘VB Enter’.
b) In Bind data to a variable, we create an array of object variables, in that variable we will define an array of object types of data. These are already defined/fixed values. We don’t need to call any API or action to fetch those data.
Step 7: We have created two tables in a single page, one for SDP and the other for ADP.
Step 8: Inside the table properties, data added in created SDP variable and selecting required fields.
After applying data and column selection, it is possible to fetch the data because of SDP, there is no need of an action or event for SDP to load the data as this is one of the features of SDP. It automatically fetches data from endpoint.
Step 9: Similarly, we did the same thing for ADP and added ADP variable inside table properties data and selected same columns which we selected for SDP.
For both ADP and SDP, we are using the same endpoint/ table from ATP, but in the UI, ADP table is not displaying any data. In the image below, ADP table displayed “No data to display.”
Step 10: Now, let’s create an action to fetch the data from ATP to display in the ADP table, where the action name is onPageLoad and the used event is vbEnter.
Step 11: In the action, we called get REST API and pass the result to ADP data variable.
Step 12: This is the result after the implementation of the action. Here, we run the page and on page load, we are fetching data from ATP to pass it to the ADP variable. Now, that data is displayed in the second table as shown in the image below.
Below are the Key Differences between them: –
Array Data Provider (ADP)
Service Data Provider (SDP)
|It serves as a static data provider, which means it functions as a consistent, unchanged source of data.
|Functioning as a data provider, this entity retrieves data from a service endpoint.
|It permits occasional additions, updates, and removal of data.
|It facilitates external fetches through an action chain.
|There are situations where the associated UI component linked to this data provider must be refreshed following alterations to the data stored in its variable.
|Differing from Array Data Provider, this operates as a dynamic data provider, adjusting its variables and UI in response to changes in the data via the designated action chain.
|All operations on the data, including sorting, adding, removing, or updating, are handled by this data provider itself.
|This comes equipped with built-in support for operations like sorting, filtering, and paging of data collections.
If you have any questions or concerns, please let us know in the comments section or write to us at email@example.com.