Legacy Dev Forum Posts

 View Only

Sign Up

Data action - parse data table into json variable or collection

  • 1.  Data action - parse data table into json variable or collection

    Posted 06-05-2025 18:46

    a.tallone.oliocarli | 2024-09-16 12:10:20 UTC | #1

    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


    a.tallone.oliocarli | 2024-09-16 14:05:04 UTC | #2

    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.


    system | 2024-10-17 13:16:47 UTC | #3

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


    This post was migrated from the old Developer Forum.

    ref: 29336