Skip to main content
Solved

Get value of parent node instead of expanding to children

  • June 26, 2024
  • 2 replies
  • 114 views

rory.smith
TimeXtender Xpert
Forum|alt.badge.img+8

I am trying to achieve something complex in the TX REST connector using table flattening.

I have the following JSON response:

 

[
    {
        "id": 1,
        "submitted": "2024-06-26T12:11:42+02:00",
        "answers": [
            {
                "question": {
                    "id": 3,
                    "label": "How do you evaluate this?",
                    "type": "SINGLE"
                },
                "answer": 9
            },
            {
                "question": {
                    "id": 4,
                    "label": "How do you rate the following elements?",
                    "type": "MATRIX_SINGLE_CHOICE"
                },
                "answer": [
                    {
                        "ids": [
                            55
                        ],
                        "labels": [
                            "Drinks"
                        ],
                        "value": [
                            "Good"
                        ]
                    },
                    {
                        "ids": [
                            56
                        ],
                        "labels": [
                            "Food"
                        ],
                        "value": [
                            "Good"
                        ]
                    }
                ]
            }
        ]
    }
]

 

So my response has an answers array which contains both a question array and an answer that is sometimes a direct value and sometimes an array. How can I create a flattening that directly reads a parent node without expanding the child nodes (ids, lables,value)?

 

Best answer by rory.smith

Hi,

I cannot exactly remember how I managed to solve this and would need to look it up.

2 replies

Forum|alt.badge.img+1
  • Contributor
  • November 4, 2024

Hello Rory,

Could you expand on the desired output? What would you like to see as a result?

 

Kind regards,

Benny Aalders


rory.smith
TimeXtender Xpert
Forum|alt.badge.img+8
  • Author
  • TimeXtender Xpert
  • Answer
  • November 4, 2024

Hi,

I cannot exactly remember how I managed to solve this and would need to look it up.