Visual Builder

Get Involved. Join the Conversation.

Topic

    ninian1927
    Can only get service data provider working with table.....Answered
    Topic posted October 23, 2019 by ninian1927Red Ribbon: 250+ Points, last edited October 23, 2019 
    28 Views, 4 Comments
    Title:
    Can only get service data provider working with table.. having trouble with my own array?
    Content:

    HI All,

    I have an endpoint from an outside application that returns data looking like:
    { } formName
      { } data
       headerfield1
       headerfield2
        { } gridData
          [ ] rowset
            { } item[i]
               quantityordered.value
               itemnumber.value
               description.value

    I can use a data service provider and point it to the endpoint and pick the fields you see there (quantityordered, itemnumber, description) and this works well. However, when doing it this way I can ONLY pick the values under the { } item[i], my problem is I also need to get at other values under the higher level { } data object. Esentially, this form has header and detail information, the detail information is a grid of data which the data service provider can select. The header detail under the { } data object is unavailable to me via the data service provider as its not part of the table data.

    So, my plan was to just populate the { }formname object with everything via the endpoint (which works), and then use this to populate the table manually. I assigned my table to look at "formName.data.gridData.rowset" but I keep getting an error:
    "Uncaught (in promise) Error: oj-table with id 'oj-table-1028266641-2': Error while rendering component. Error: Invalid data type. Please specify the appropriate data type."

    When I have done this in straight Oracle JET in the past I always created an array and assigned it the value formName.data.gridData.rowset, and its always worked. Am I missing something here? I've reviewed as many documents as I can find but most examples use simple CRUD endpoints.

     

    Best Comment

    Shay Shmeltzer

    One possible approach would be to define an additional variable of type ArrayDataProvider (ADP).

    Then call the REST and put it into the variable you already have, and then use an assign variable action to assign the data in the rowset array to the data[] array in the ADP.

    Then use the ADP as the data for your table.

    Comment

     

    • Preetesh Dongre

      Hi Ninian,

      You have to parse the data in JS for hierarchical structure and extract the values. 

      Regards,

      Preetesh

      • ninian1927
        Is there an example of this? Do I just need to create an array variable and assign the contents of formName.data.gridData.rowset to it?
        
    • Shay Shmeltzer

      One possible approach would be to define an additional variable of type ArrayDataProvider (ADP).

      Then call the REST and put it into the variable you already have, and then use an assign variable action to assign the data in the rowset array to the data[] array in the ADP.

      Then use the ADP as the data for your table.