Visual Builder

Get Involved. Join the Conversation.

Topic

    aaina Khan
    Service connection calls doesn't work with filter...Answered
    Topic posted May 31, 2019 by aaina KhanRed Ribbon: 250+ Points, tagged Business Objects, JET, Services, UI 
    86 Views, 10 Comments
    Title:
    Service connection calls doesn't work with filter criterion
    Summary:
    Service connection calls doesn't work with filter criterion, but business object endpoints do
    Content:

    I tried creating a select dropdown which has values dynamically assigned through an SDP. the SDP fetches record fro a BO calling its endpoint. The BO has more than 100 records and it just works fine. Search also worked fine in the select dropdown. The rest call goes wit the filter value.

    Then I created a service connection for this BO and assigned the same service connection to the SDP with query parameter q. now when I search in the select, it doesn't shows up more the results.  Rest call goes for each key I type in but the filter/parameter isn't appended, because of which i am not getting the intended value.

    I just concluded that the filter criterion doesn't work if I add q parameter as url parameter for the service connection. Please help me how to make it work exactly like the one that works with the SDP calling BO endpoint directly.

    Best Comment

    Shay Shmeltzer

    Is your BO in another app from the one you are building? (Otherwise the REST endpoints should already be there for you).

    If you are defining a connection to a BO based REST endpoint you should use the option to "define by specification" -> and switch to the "API Type" to the ADF Describe option.

    https://docs.oracle.com/en/cloud/paas/app-builder-cloud/visual-builder-developer/create-service-connection-service-specification.html

    Then point to the metadata URL of your service. 

    This will give you filtering, sorting, and pagination out of the box.

     

     

    Comment

     

    • Shay Shmeltzer

      I'm not clear what you are trying to achieve.

      If you are using BO's then using the built in filter functionality that the SDP provides already works right?

      If you want the same functionality on a random REST endpoint - then that REST endpoint will need to support some way of filtering records on the backend.

      Then you will need to write a service transform function to tell VB how to invoke this filtering and then the SDP behavior will work out of the box.

      Info here - Add Filtering, Sorting and Pagination Functions                               

      If you want to consume a service from a BO in another app - you should import it using the "based on spec/ADF Describe" option - and then it will work out of the box again. Similar to this: https://blogs.oracle.com/shay/oracle-jet-ui-on-top-of-oracle-adf-with-visual-builder

       

    • aaina Khan

      Shay,

      Thanks for the response. I tried enabling the transform option and now on filtering the query to the service goes but the operator value is wrong. 

      If I try in BO, the filtering value goes like Country like "%canada%" . but in this case the query is calling as Country co "canada" and so the query fails with 400 bad request. 

      I understand I need to write a service transform function to tell VB how to invoke this filtering, but stuck up on where to start. Is there any related source that you have or can you provide a sample would be of great great help.

      Thanks.

    • Shay Shmeltzer

      Are you trying to access a BO or a random external REST service?

      If you are invoking a random REST service - does it support filtering? If so how does it expect to get the conditions for filtering?

    • aaina Khan

      Am trying to access a business object through a service connection. I created a service connection for the business object only with getAll endpoint.

    • Shay Shmeltzer

      Is your BO in another app from the one you are building? (Otherwise the REST endpoints should already be there for you).

      If you are defining a connection to a BO based REST endpoint you should use the option to "define by specification" -> and switch to the "API Type" to the ADF Describe option.

      https://docs.oracle.com/en/cloud/paas/app-builder-cloud/visual-builder-developer/create-service-connection-service-specification.html

      Then point to the metadata URL of your service. 

      This will give you filtering, sorting, and pagination out of the box.

       

       

    • aaina Khan

      I have one more issue with this filter criterion that it just forgets the previous query assigned to it.

      I'll explain the scenario. I have a business object that has countryCode, StateCode and StateName fields. For each countryCode multiple StateCodes exist and will be displayed in the state drop down for a particular country (say India the states will be 37 for example). 

      Initial filter criterion that I set for this SDP  to get all the state code as Value and State Name as Label for the select drop down and the criterion is countryCode = 'IN' for instance , The drop down will display all the states of the country India (IN). Now only 15 values display in the drop down and I can search further to get more. But the search query that goes from here doesn't include the countryCode criteria. and so search results displays all the values irrespective of country which is wrong in my case.

      How can I include the initial condition of countryCode to the search criteria for select dropdown? 

      • Shay Shmeltzer

        The search in the selectOne component is not aware of the filter condition you applied earlier.

        It is up to you to make it aware of the combined conditions.

        the component filter needs to be appended to the 
        compound criteria configured on the SDP. And this needs to be done in JS 
        using the 'mergeTransformOptions' property of the SDP.

        You can request a sample app from Oracle support if you refer to bug 29038351 and ask to get the sample solution provided there.

        • aaina Khan

          I tried to search for the above bug 29038351  but didn't get any results in oracle support site. 

          Could you please help me with a sample app as this has become an urgent issue to be fixed in our app?