Getting list of data from relation - Forum - Mobile - Progress Community

Getting list of data from relation

 Forum

Getting list of data from relation

This question is not answered
order lines.png

Hi all,


This is my situation:
I'm building an app which has an object called "workorder". The object has an 1-n relationship to the "workorder line" object. Listing the workorders is no problem, just invoke the "getView_All..." service, and the list is being filled. When navigating to  the detail page of the workorder object, I have list of related workorder lines. To fill the list I use the service called "getAll_R****". But this service only returns generic data (name, id), and I need more information like you can see in my attachment.

Does anyone know how I can get all the data of the related objects?

Thanks in advance,

Harrie.

All Replies
  • Hi Harrie,
     
    In order to populate the related elements in the Mobile App Builder we need to use the relational service that gets generated as part of the Mobile App creation with selected/exported views. Further to get complete record information of the related record we need to use specific JSDO service (Read service). Following example illustrates usage of relational service in Mobile App Builder.
     
    I have attached sample application XML file (inclusive of both Rollbase and Mobile app) which has required functionality.

     
    Considering Customer Order Example: As per your requirement you are trying to read complete Order (record) information after getting all orders of a given customer.
     
    Customer Page:

    ·         Invoke a JSDO Service for Customer and on success:

    ·         Invoke a Service to read the Customers  (either just id and name with getAll_Customer or use the getView_All_Customer to get all fields)

    ·         Map the fields you would like on the List to Labels/placeholders (Name and any other fields you want on the screen inside your list)

    ·         Create a hidden field inside the list called CustomerId and map the ID field (from Customer) to this hidden field

    ·         On Click of the List set a LocalStorageVariable that maps localCustomerId to the CustomerId Text (Bind to component)

    ·         On Click (after the above) Navigate to your Order Page

     
    Order Page:

    ·         On Page-Show invoke the Service OrderJSDO

     
    List of Orders related to Customer:

    ·         On Page-Show invoke the Service rcustomer_getAll_R2233984

    ·         On the service above Map localCustomerId (local storage variable) to the ID on the request

    ·         Create a list and place a OrderName label and a hidden OrderID inside your list

    ·         Map the GenericData from rcustomer_getAll_R2233984  response to the list Item (multiple records)

    ·         Map Name to the label OrderName

    ·         Map ID to the hidden label OrderID

     
    Order Details:

    ·         On Click of the OrderList set a LocalStorageVariable that maps localOrderId to the OrderID Text (Bind to component)

    ·         On Click of the OrderList item (after the above) invoke the Order_Read service and pass localOrderId (localStorageVariable) as the filter on the request (to read service)

    ·         Map the Order_Read fields from the response to your details on the screen

     
    Hope this helps.
     
    Thanks and Regards,
    Anil Kumar.
     
    From: Harrie Kuijper [mailto:bounce-hkuijper@community.progress.com]
    Sent: Monday, December 08, 2014 6:51 PM
    To: TU.Mobile@community.progress.com
    Subject: [Technical Users - Mobile] Getting list of data from relation
     
    Thread created by Harrie Kuijper

    Hi all,


    This is my situation:
    I'm building an app which has an object called "workorder". The object has an 1-n relationship to the "workorder line" object. Listing the workorders is no problem, just invoke the "getView_All..." service, and the list is being filled. When navigating to  the detail page of the workorder object, I have list of related workorder lines. To fill the list I use the service called "getAll_R****". But this service only returns generic data (name, id), and I need more information like you can see in my attachment.

    Does anyone know how I can get all the data of the related objects?

    Thanks in advance,

    Harrie.

    Attachments:
    order lines.png
    Stop receiving emails on this subject.

    Flag this post as spam/abuse.

  • Hi Anil,

    Thanks for your answer, most of the steps are already implemented in my current app. But your solution is not exactly what I want. At the step "List of Orders" I want a list with more information about the object, instead of a list with just the name of the object. Example: (in this case I use a grid element)

    Length | Width | Name

    1 | 2 | test1

    2 | 3 | test2

    The custom fields (Length, Width) in this example are not available in the getAll_R**** service. So I tried to add the read service on the success event of getAll_R****, but it didn't work.