Visual Builder

Get Involved. Join the Conversation.

Topic

    Harsh Kaul
    Implementing master-detail relationship using RESTful...Answered
    Topic posted July 25, 2018 by Harsh KaulGreen Ribbon: 100+ Points, last edited November 27, 2018 by Arijit ChakrabortyBronze Trophy: 5,000+ Points, tagged REST 
    254 Views, 5 Comments
    Title:
    Implementing master-detail relationship using RESTful services
    Summary:
    master-detail
    Content:

    Hello Gurus,

    I am trying to implement a simple master-detail requirement to display orders as a master table in my web application (order no, date, customer name, address) along with order lines as a detail table displaying related information (Item no, Description, Qty, Rate, Amount). If a certain row is clicked in the master, the detail table should display items related to the order id selected previously.

    These details are fetched from 2 different rest APIs and not data objects.

    My problem is that I'm unable to display the order details within the page. Though I can see the call being made to the detail api in the network monitor (the values are fetched but not mapped to the order lines table service data provider)

    Things I have tried already -

    1. Created a first-selected-row event on the master and called the detail restful api from the action chain passing orderid as input parameter

    2. Assigned the response type to the service data provider (SDP) of the child table

    3. Assigned the result to the filterCriterion

    4. Created a custom fetch action chain on the child sdp and tried calling it from the first-selected-row action chain that was on the master table.

    5. Refreshing the sdp after assigning the resultset to it.

    Please let me know if more details are needed as I'm new to VBCS. Any help is appreciated.

     

    Thanks and best regards,

    Harsh Kaul

     

    Image:

    Best Comment

    JT Thomas

    The approach taken in #1 is the most appropriate. You say you see the correct (filtered) result coming back from the detail call? Then its an issue of data binding that result to the control. If that is the last screen of your screenshot, I think the mistake is in your assignment. You should map that to a page variable that you create, likely an array type. Then bind that variable to your table in the designer. Does that make sense?

    ~/jt

    Comment

     

    • JT Thomas

      The approach taken in #1 is the most appropriate. You say you see the correct (filtered) result coming back from the detail call? Then its an issue of data binding that result to the control. If that is the last screen of your screenshot, I think the mistake is in your assignment. You should map that to a page variable that you create, likely an array type. Then bind that variable to your table in the designer. Does that make sense?

      ~/jt

    • Harsh Kaul

      Thanks JT, let me try that approach. Thanks for your reply.

       

      Best regards,

      Harsh

    • Harsh Kaul

      Hi JT,

       

      The mentioned approach works for me and I'm able to fetch order lines. Another question now, please bear with me. By default, a service data provider variable is bound to the table when you drag and drop one on the page. Does a service data provider variable not support this requirement of master-detail and we have to go use an array data provider type variable? Is this a fair assumption?

       

      Thanks and best regards,

      Harsh

      • Shay Shmeltzer

        Did you run into any issues with filtering an SDP using filterCriterion?

        You should be able to just update the filterCriterion of the SDP using an "assign variable" action - and this will force the SDP to re-fetch the values based on the new criteria.

         

    • Ameur Baccoucha

      Hi Arjiit,

      I wanna to do the same thing and i am new with VBCS so can you explain a little bit how you did it and thank you