Data action - parse data table into json variable or collection

Hi everyone!

I need to parse a data table and use it into a flow. The final purpose is to find in what "threshold" of available agents I'm in.

I've been able to get table keys with a data action:

Output contract:

{
"type": "object",
"properties": {
"pageSize": {
"type": "integer"
},
"total": {
"type": "integer"
},
"pageCount": {
"type": "integer"
},
"pageNumber": {
"type": "integer"
},
"entities": {
"type": "array",
"items": {
"type": "object",
"properties": {
"key": {
"type": "string"
}
},
"additionalProperties": true
}
}
},
"additionalProperties": true
}

Raw json:

{
"pageSize": 25,
"total": 14,
"pageCount": 1,
"pageNumber": 1,
"entities.key": [
"10",
"12",
"14",
"15",
"18",
"20",
"22",
"25",
"30",
"35",
"40",
"5",
"6",
"8"
]
}

Output:

Specifically, I need to put such keys (and related values) into a variable in order to perform iteration in a flow, confronting them with my available agents.

Thank you very much for any advice, and I hope to have been clear.

Best regards,
Alberto

I made some progress:

Output contract:

{
  "type": "object",
  "properties": {
    "entities": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "Code": {
            "type": "integer"
          },
          "key": {
            "type": "string"
          }
        },
        "additionalProperties": true
      }
    }
  },
  "additionalProperties": true
}

JSON:

{
  "pageSize": 25,
  "total": 14,
  "pageCount": 1,
  "pageNumber": 1,
  "entities.Code": [
    4,
    5,
    6,
    7,
    8,
    9,
    10,
    11,
    13,
    15,
    18,
    1,
    2,
    3
  ],
  "entities.key": [
    "10",
    "12",
    "14",
    "15",
    "18",
    "20",
    "22",
    "25",
    "30",
    "35",
    "40",
    "5",
    "6",
    "8"
  ]
}

Now I need help with the translation map, I tried:

{
  "translationMap": {
    "Agenti": "$.entities.[*].key",
    "Code": "$.entities.[*].Code"
  },
  "translationMapDefaults": {
    "Agenti": "[]",
    "Code": "[]"
  },
  "successTemplate": "{\n   \"Agenti\": ${Agenti}\n, \"Code\": ${Code}\n}"
}

JSON:

{
  "Code": [
    4,
    5,
    6,
    7,
    8,
    9,
    10,
    11,
    13,
    15,
    18,
    1,
    2,
    3
  ],
  "Agenti": [
    "10",
    "12",
    "14",
    "15",
    "18",
    "20",
    "22",
    "25",
    "30",
    "35",
    "40",
    "5",
    "6",
    "8"
  ],
  "entities.key": [
    null
  ],
  "entities.Code": [
    null
  ]
}

Thanks for any help.

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.