Sure! First response:
{
"success": true,
"result": [
{
"id": 4648,
"sum": 10000,
"organisation": "org1",
"type_title": "type1",
"printer_address": "address1",
"method": "Sale"
},
{
"id": 4651,
"sum": 100,
"organisation": "org1",
"type_title": "type1",
"printer_address": "address1",
"method": "Sale"
},
{
"id": 4652,
"sum": 100,
"organisation": "org2",
"type_title": "type1",
"printer_address": "address2",
"method": "Sale"
},
{
"id": 4653,
"sum": 100,
"organisation": "org2",
"type_title": "type2",
"printer_address": "address1",
"method": "Sale"
}
],
"error": null
}
Second response:
{
"success": true,
"result": [
{
"id": 4648,
"sum": 10000,
"organisation": "org1",
"type_title": "type1",
"printer_address": "address1",
"method": "Sale"
},
{
"id": 4651,
"sum": 100,
"organisation": "org1",
"type_title": "type1",
"printer_address": "address1",
"method": "Sale"
},
{
"id": 4652,
"sum": 100,
"organisation": "org2",
"type_title": "type1",
"printer_address": "address2",
"method": "Sale"
},
{
"id": 4653,
"sum": 100,
"organisation": "org2",
"type_title": "type2",
"printer_address": "address1",
"method": "Sale"
},
{
"id": 4654,
"sum": 100,
"organisation": "org2",
"type_title": "type2",
"printer_address": "address1",
"method": "ReturnSale"
},
{
"id": 4655,
"sum": 200,
"organisation": "org2",
"type_title": "type3",
"printer_address": "address1",
"method": "ReturnSale"
}
],
"error": null
}
So, as you can see, the second response exactly contains the first response and possibly additional data. In this case, I need to get a table:
In second response we have:
{
"id": 4653,
"sum": 100,
"organisation": "org2",
"type_title": "type2",
"printer_address": "address1",
"method": "Sale"
},
{
"id": 4654,
"sum": 100,
"organisation": "org2",
"type_title": "type2",
"printer_address": "address1",
"method": "ReturnSale"
}
Exact same printer_address, organisation and type_title, but different method, so we summarize the sum value and put it in appropriate cell (highlighted in green in image).
Also, in the second response we have:
{
"id": 4655,
"sum": 200,
"organisation": "org2",
"type_title": "type3",
"printer_address": "address1",
"method": "ReturnSale"
}
We don’t have address1, org2 and type3 data from the first response, so it should be ignored.
I hope this brought some clarity.