Additional parameters to Read method using JSDO? - Forum - Mobile - Progress Community

Additional parameters to Read method using JSDO?

 Forum

Additional parameters to Read method using JSDO?

This question is answered

I have a simple business entity "Person" which I use as a datasource for a kendoAutoComplete element:

    var jsdoPersons = new kendo.data.DataSource({
        type: "jsdo",
        transport: {
            jsdo: "Person"
        },
        serverFiltering: true
    });

The Person class has a ReadPerson method for returning the dataset and it works as expected.

Now, if I wanted to pass other parameters to the method besides the standard filter parameter, how could that be done? Or should I make an invoke method instead? I have changed the ReadPerson method like this:

    @openapi.openedge.export(type="REST",...
    @progress.service.resourceMapping(type="REST", operation="read", URI="?filter=~{filter~}&param2=~{param2~}", ...
    METHOD PUBLIC VOID ReadPerson(
            INPUT filter AS CHARACTER, 
            INPUT param2 AS CHARACTER,    // additional parameter
            OUTPUT DATASET dsPerson):    

With this change, JSDO automatically adds "&param2=" to the service url but I don't know how to set a value for that additional parameter, it is always empty.

So the generated url is like:
http://..../Person?filter={...}&param2=&ts=... 

How can I set a value for param2? I have tried setting it in DataSource settings and in beforeFill method, but no luck so far.

Verified Answer
  • Hello,

    The JSDO would recognize the additional parameter in the catalog and pass it to the server when calling the JSDO.fill({ ... }) method with the appropriate parameters.

    However, this approach is not currently supported.

    There are some few ways that you can go about this:

    1) Use an invoke operation.

    2) Use the JSON Filter Pattern.

    3) Use the your own mappingType for mapping options for a query. This approach is not currently supported but it was described in other posts in Progress Community.

    What is param2 used for?

    What version of OpenEdge are you using?

    The following post in Progress Community can be useful to you:

       community.progress.com/.../79079

       community.progress.com/.../69428

       community.progress.com/.../69540

       community.progress.com/.../24019

    I hope this helps.

    Thanks.

All Replies
  • Hello,

    The JSDO would recognize the additional parameter in the catalog and pass it to the server when calling the JSDO.fill({ ... }) method with the appropriate parameters.

    However, this approach is not currently supported.

    There are some few ways that you can go about this:

    1) Use an invoke operation.

    2) Use the JSON Filter Pattern.

    3) Use the your own mappingType for mapping options for a query. This approach is not currently supported but it was described in other posts in Progress Community.

    What is param2 used for?

    What version of OpenEdge are you using?

    The following post in Progress Community can be useful to you:

       community.progress.com/.../79079

       community.progress.com/.../69428

       community.progress.com/.../69540

       community.progress.com/.../24019

    I hope this helps.

    Thanks.

  • Hi, I am using 11.6.1.

    I was thinking to use param2 e.g. to dynamically modify the schema for the return dataset. One reason is to minimize network traffic by excluding unnecessary fields from the dataset. I know that this could be achieved by creating several services with different views (temp-tables) of the same data but I was hoping to have a more flexible way.

    Another use case for param2 might be to define the desired language for returned data.

    Thanks for your quick reply and for the links, those seem to be helpful, I have to check them out.

    EDIT: I just tried the option 3 (customized mappingType) and it worked nicely. Thanks again!