Combine 3 tables into a Json string for PUT action
Question

I am consuming a 3rd party API in my App I can get data into the local storage in 3 tables. But how do I combine those 3 tables back into Json to send to the PUT of the REST API.

Example of the Json I need to send back below.


{

    "service": {

        "id": 1,

        "machineID": 1,

        "machineName": "test machine",

        "machineSerialNo": "TNP-111-222-333",

        "serviceStatus": "Open",

        "serviceStartDate": "2021-06-01T00:00:00",

        "serviceEndDate": "2021-06-08T00:00:00",

        "notes": "          "

    },

    "serviceTaskList": [

        {

            "id": 1,

            "serviceId": 1,

            "currentAssemblyID": 1,

            "currentAssemblyName": "Test Assembly",

            "taskName": "Clean doofers",

            "taskQuoteName": "Clean Doofers",

            "taskDescription": "Clena the doofers",

            "notes": " ",

            "serviceTaskPartList": [

                {

                    "id": 1,

                    "taskId": 1,

                    "partId": 1,

                    "partName": "Test Part 1",

                    "qtyNeeded": 50,

                    "qtyUsed": 35,

                    "qtyReturned": 10,

                    "qtyLeftOnSite": 5

                },

                {

                    "id": 2,

                    "taskId": 1,

                    "partId": 2,

                    "partName": "Test Part 2",

                    "qtyNeeded": 500,

                    "qtyUsed": 499,

                    "qtyReturned": 1,

                    "qtyLeftOnSite": 0

                }

            ]

        },

        {

            "id": 2,

            "serviceId": 1,

            "currentAssemblyID": 2,

            "currentAssemblyName": "Test Assembly two",

            "taskName": "Vacuum Buffers",

            "taskQuoteName": "Vacuum Buffers",

            "taskDescription": "Vucuum the buffers",

            "notes": " ",

            "serviceTaskPartList": [

                {

                    "id": 3,

                    "taskId": 2,

                    "partId": 3,

                    "partName": "Test Part 3",

                    "qtyNeeded": 500,

                    "qtyUsed": 30,

                    "qtyReturned": 3,

                    "qtyLeftOnSite": 1

                }

            ]

        }

    ]

}

The 3 Structures match this as do the tables except the structures have the List of Tasks and List of Task Parts respectively.

The tables in my Local storage don't have identifier keys but do take data from the API's GET so I don't have links between the tables in the diagram.

I am new to outsystems so as such not really up to speed with the interface so dummy explanations if possible. :-)


Thanks in advance.


Frosty



Jitendra,


Thanks for the response I found the second one but I don't understand from the pictures in the question how it works.


I get you have an aggregate step that calls the first file and you use the ID from that to call the records for the second aggregate and the same with the third table. But how do you combine those three answers into a an output that is required?


Below is a picture of what i have so far. 


And how do I pass it to the end point

Capture.JPG

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.