Data Object Service - How do I pass a query parameters to an

Posted by Cherian George on 03-Jul-2019 17:30

Hello All, 

I have a Business Entity Class with a Read Operation, However, I need to to be able to pass multiple values to the filter. Looking through all the random stuff I could find on the Internet it looks like defining the Input Parameter as an Array seems to be the best option 

Now the question I am challenged with is how do I construct my HTTP parameters 

I am indeed a newbie to Data Services and cannot seem to find any documentation around this 

@openapi.openedge.export(type="REST", useReturnValue="false", writeDataSetBeforeImage="false").
@progress.service.resourceMapping(type="REST", operation="read", URI="?filter=~{filter~}", alias="", mediaType="application/json").
METHOD PUBLIC VOID ReadUIObjects(
INPUT filter AS CHARACTER EXTENT,
OUTPUT DATASET dsUIObjects):
MESSAGE 'READING UI OBJECTS'.
MESSAGE "1" filter[0] skip "2" filter[1].


END METHOD.

All Replies

Posted by Peter Judge on 16-Jul-2019 14:22

The Data Object Service "READ" operation has a fixed signature of
INPUT filter AS CHARACTER, OUTPUT DATASET <be-dataset>
 
All of the other non-Invoke operations (Create, Update, Delete) have a fixed signature of
                INPUT-OUTPUT DATASET <be-dataset>
 
Invoke operations may have (just about) any signature.
 
There's doc on the JSDO (client) operations at  docs.progress.com/.../Overview-of-Progress-Data-Objects-Services-and-Catalogs.html ; you may be able to find more info about developing the BE (ABL code) from there or by searching for "data object services" in the docs page.
 
If you want to have non-prescriptive signatures and requests , you can look at the Data Object Handler ( docs.progress.com/.../Use-a-Data-Object-Handler.html ), a custom WebHandler or the REST mapping tool.
 
 

Posted by egarcia on 16-Jul-2019 15:39

Hello,

When working with Data Object Services, you can use the filter CHARACTER parameter as a freeform string and have your own code on the Business Entity to interpret the content.

For example, to pass an array, the string parameter can have a comma-delimited list of values or a serialized JSON object.

Are you working with JavaScript on the client-side?

A possible approach in JavaScript would be to serialize the array into a string then pass the string in the request and de-serialize the string on the Business Entity side.

On the client side, you would use JSON.stringify(array) and on the ABL side, you would use something like "CAST(jsonParser:Parse(filter), jsonObject)" to convert the filter parameter to a JSON object.

We use this approach to overload the filter parameter and pass Kendo UI filter queries. We call this approach JSON Filter Pattern (JFP).

(If you are working with the JSDO, you can add your own plugins to implement your own filter pattern.)

Here is the link showing the sample implementation for JFP:

- documentation.progress.com/.../index.html

Please let me know if you need more info on this approach.

I hope this helps.

This thread is closed