Query Logic Implementation in VBCS for ADF BC REST
In this post, I will explain how to implement query logic against external REST service connections.
Join the DZone community and get the full member experience.Join For Free
Oracle Visual Builder Cloud Service allows defining external REST service connections. In this post, I will explain how to implement query logic against such service. The connection is defined for ADF BC REST service.
Wizard provides an option to add query parameters: both static and dynamic. I have set one static parameter only Data=true, to return data only from the service. Also, I have created multiple dynamic parameters, the one used in this use case — q parameter. This parameter accepts query expression to filter data. Later in VBCS action chain, I will assign a value to this parameter, and service will be re-executed to bring filtered data:
Search form elements will be assigned with page scope variables to hold user query input. On the search button, click, VBCS action chain will be invoked to read these values and update query parameter. Page scope variables:
Variables firstNameQueryVar and lastNameQueryVar are assigned to search form fields, here is example:
The search button invokes an action chain:
An action chain does two things — calls JS function to construct query parameter and then assigns returned value to rest service query parameter to execute search:
JS function is mapped to accept input parameters from search form input fields:
JS function code — parameters are joined into ADF BC REST query string:
JS function result is mapped with page scope variable — the result is assigned to this variable:
REST service query parameter q variable is assigned with this value. Once value changes, query is automatically re-executed:
In my next post, I will explain how to implement filtering and pagination with transformation function, on top of service connection:
VBCS sample application code is available on GitHub (if you download ZIP from GitHub, make sure to extract it and create new archive including extracted content directly, without top folder).
Published at DZone with permission of Andrejus Baranovskis, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.