cancel
Showing results for 
Search instead for 
Did you mean: 

How to display data obtained from a REST API in an Object table in a MDK Application?

juanforero5
Participant

I have a particular case, I have to consume a REST API where the input parameters have the following structure:

{
    "T_InvSkyVMovilAfs": [
        {
            "Referencia": "TOBAGO",
            "Vendedor": "180"
        }
    ]
}

and the response from the REST API is as follows:

{
    "MT_InvSkyVMovilAfsResp": {
        "T_InvSkyVMovilAfsResp": [{
            "T_CabeceraInvSkyVMovil": {
                "Reference": "TOBAGO",
                "T_Detalle": [{
                        "Color": "BLACK 10",
                        "CantDisponible": "7939.100"
                    },
                    {
                        "Color": "WHITE 10081",
                        "CantDisponible": "66996.200"
                    }
                ],
                "T_Message": {
                    "TipoMsj": "S",
                    "TextMsg": "Satisfactory"
                }
            }
        }]
    }
}

Attached image in postman.

The point is that I need to display the data of "Color" and "CantDisponible" in a object table.

The code of the object table that I am using is the following:

{
	"Controls": [
		{
			"_Type": "Control.Type.SectionedTable",
			"_Name": "SectionedTable0",
			"Sections": [
				{
					"_Type": "Section.Type.ObjectTable",
					"Target": {
						"Service": "/SkyCM_QA1/Services/Rest_Pedido.service",
						"Path": "/InvSkyVMovil",
						"RequestProperties": {
							"Method": "PUT",
							"Body": {
								"T_InvSkyVMovilAfs": [
									{
										"Referencia": "TOBAGO",
										"Vendedor": "180"
									}
								]
							}
						}
					},
					"_Name": "SectionObjectTable0",
					"Visible": true,
					"EmptySection": {
						"FooterVisible": false
					},
					"ObjectCell": {
						"ContextMenu": {
							"Items": [
							],
							"PerformFirstActionWithFullSwipe": true
						},
						"Title": "Color: {Color}",
						"Subhead": "Cant disponible: {CantDisponible}",
						"DetailImageIsCircular": false,
						"PreserveIconStackSpacing": false,
						"AccessoryType": "none",
						"Selected": false
					},
					"DataPaging": {
						"ShowLoadingIndicator": false,
						"PageSize": 50
					},
					"HighlightSelectedItem": false,
					"Selection": {
						"ExitOnLastDeselect": true,
						"LongPressToEnable": "None",
						"Mode": "None"
					}
				}
			]
		}
	],
	"_Type": "Page",
	"_Name": "Inven_Ord_Color",
	"Caption": "Inven_Ord_Color"
}<br>

Making a recording of the logs of my mobile application, I get that the request if it is doing well, the REST service if it is returning data. I just haven't been able to visualize them in the object table.

Attached screenshot of the recording of the logs where it throws me the answer.

If someone knows how to obtain that data that is returning to me to be able to visualize them in the table object it would be of great help thanks

I have a suspicion of the way in which the REST API responds since it has an object inside another object and it has ARRAY, in this case how would I access the data of "color" and "cantDisponible" in order to be displayed

bill_froelich
Product and Topic Expert
Product and Topic Expert
0 Kudos

What are you trying to show in the object table? The list of T_InvSkyVMovilAfsResp or the list of T_Detalle within the one response?

c_chowdary
Participant
0 Kudos

Did you figure it out. If yes, please share. Thanks a lot.

Accepted Solutions (0)

Answers (1)

Answers (1)

bill_froelich
Product and Topic Expert
Product and Topic Expert
0 Kudos

In the MDK Rest Service Send Request action, you can define the Output path to narrow down the return value to the list you want to use in the object table. This will allow you to have the list target the array within the result and then just bind to the individual properties in each array item.