Scroll to top

Filter Data using Q Parameter in Oracle VBCS


Swaroop Shetty - June 5, 2023 - 0 comments - 216 Views

Reading Time: 5 minutes

What is the use of query parameters?

Query parameters are a defined set of parameters attached at the end of a URL. They are extensions of the URL used to help define specific content or actions based on the data being passed.

You can use query parameters to control what data is returned in endpoint responses.

Query Parameters:

You can use the following query parameters in the Connect REST API.

Parameter

Description

ExpandSupported only with the file Attachment resource, for example, see Download Individual File Attachments
FieldsReturns only the specified, comma-separated list of fields for collection resources, such as incidents or contacts, or for individual objects. The fields query parameter supports dotted notation.

Collection resources. Use the GET method with the following query syntax to return data for multiple objects:

https://your_site_interface/services/rest/connect/v1.4/resource?fields=field1,field2,…

 

Objects. Use the GET method with the following query syntax to return data for a single object:

 

https://your_site_interface/services/rest/connect/v1.4/resource/resource_id?fields=field1,field2,…

 

Note: Queries on subfields, such as name only works with individual resources and not with collections.

 

LimitSets the page size.
LinksReturns only the specified, comma-separated set of links for a particular object.

Use GET with the following query syntax:

https://your_site_interface/services/rest/connect/v1.4/resource/resource_id?links=link_type1,link_type2,…

OffsetDetermines the record number from which to start retrieval. See Pagination.
OrderByDetermines the sort order of results like sorting.
QSee Run ROQL Object Queries.
QuerySupported only with the queryResults resource. See Run ROQL Tabular Queries.
TotalResultsLet’s you display the total number of results like pagination.
OnlyDataDisplay only data except links and other attachments.
FindersTo find some specific values.

Applying the Q parameter through VBCS. choose the endpoint; let’s start with the back end.

You may see various names along with their types and values in the request under the Query Parameter heading. Additionally, there are options that must be checked if you want to mark them as mandatory.

Try using just one of the names. onlyData has Boolean values that are true or false, indicating that the user simply wants to view the data in the API response without links or additional attachments.

Limit refers to the user’s ability to access a specific amount of data in the request listed below limit.

According to the request, this is the output. A request that has a limit and only data for the Q parameter.

Count indicates how many items in the response, as we requested for 1 limit that’s we can get 1 value in count.

orderBy, which denotes the ascending or descending order of a field’s data. In the example below, we have used bodyType:desc.

bodyType: field name

desc: descending

The response that is shown depends on the Q parameter that we have mentioned.

You can try it with the front-end by creating a service data provider (SDP) or array data provider (ADP), choosing the endpoints, and mentioning the key attribute in that.

Please check out our previous blog post, “Creating a simple VBCS application in 5 Easy Steps,” if you are not sure how to define variables and types.

After making a variable, make a table to show the output from the user interface. We must choose the appropriate fields in the table’s properties for the various fields it contains.

CarsDetails is the name of a table we have created using a VBCS business object; alternatively, ICS or ORDS can be used.

Now you can see the list of parameters in the map variables to parameters section on your right under the targets. We are applying inside the variable in a manner similar to how we tested from the back end.

First try with the limit, limit = 5

In this output, the table only shows five records.

Try using the bodyType field and descending as an attribute with orderBY which is applied for the same table.

In the table BodyType result, the first row of output begins with the letter S for SUV.

The orderBy function assumes an ascending format if you only include the field name. In the following image, the field name is all that is mentioned.

This is the output, with the bodytype’s first row value beginning with the letter H in HATCHBACK.

Currently, there is only one field name under the fields listed, limit is 15, and orderBy ascending.

This is the response to the prior request.

Examples:

orderBy: model:desc

expand: contacts.names

In the previous instance, contacts.name is specified as being part of the HCM contacts api.

If a user wishes to obtain information from a name, such as a first name, middle name, last name, full name etc they must expand the name just like parent and child.

We have discussed this in the extend parameter section.

finder : $functions.getConversionRate($page.variables.carsdetails.Currency, $page.variables.currencyData.ToCurrency, $page.variables.currencyData.UserConversionType, $page.variables.currencyData.startDate, $page.variables.currencyData.endDate)

All the variables that have specified values are listed above.

/fscmRestApi/resources/11.13.18.05/currencyRates?finder=CurrencyRatesFinder;fromCurrency=INR,toCurrency=USD,userConversionType=Corporate,startDate=2005-01-19,endDate=2005-01-20

This is being used to determine fscm’s currency conversion rate.

Swaroop Shetty
Author avatar

Swaroop Shetty

https://conneqtiongroup.com/

Related posts

Post a Comment

Your email address will not be published. Required fields are marked *