Flexmonster MCP Server is here! Connect your ✨AI assistant to our documentation. Get started
+

How to separate items in a value array?

Answered
Yuqi Zhou Yuqi Zhou asked on September 23, 2020

Hi!
I have a question about flexmonster pivot table. I am trying to use pivot table to display some survey answers. Some answers to survey questions are arrays of items. Like in the following format:

[
    {
        "The Number of Responses": 1,
        "question1": [
            "item2"
        ],
        "question3": "hello",
        "question2": "",
        "question4": "item1",
        "Gender": "F"
    },
    {
        "The Number of Responses": 1,
        "question1": [
            "item3",
            "item2"
        ],
        "question3": "question3",
        "question2": "",
        "question4": "item2",
        "Gender": "F"
    }
]

The answer to question question1 is an array of items. Right now, in my pivot table, answer [item3, item2] is together in a cell. Do you know how to separate them and then I will have item2: 2, item3: 1? Does we have any API which I can use to solve this problem?
 
Thanks!
 

Attachments:
image.png

3 answers

Public
Mykhailo Halaida Mykhailo Halaida ⋅ Flexmonster ⋅ September 25, 2020

Hi Yuqi,
 
Thank you for posting your question!
 
Please note that Flexmonster currently does not support multiple-values field types. 
 
What we usually suggest in such situations is to preprocess such data & split it into separate entries before loading the data set to the pivot table. For example, the following entry:
 

{
"The Number of Responses": 1,
    "question1": [
     "item3",
     "item2"
    ],
    "question3": "question3",
    "question2": "",
    "question4": "item2",
    "Gender": "F"
}

 
would be split into these two:
 

{
"The Number of Responses": 1,
"question1": "item2",
"question3": "question3",
"question2": "",
"question4": "item2",
"Gender": "F"
},
{
"The Number of Responses": 1,
"question1": "item3",
"question3": "question3",
"question2": "",
"question4": "item2",
"Gender": "F"
}

 
This way, your data will be displayed as expected, without multiple answer options being shown in a single cell.
 
Please let us know if this helps.
 
Best regards,
Mykhailo

Public
Mykhailo Halaida Mykhailo Halaida ⋅ Flexmonster ⋅ October 5, 2020

Hi Yuqi,
 
Hope you're doing well.
 
Just checking in to ask if you've had a chance to check out our response. Do you think the suggested approach would work for you?
 
Please let us know your thoughts.
 
Regards,
Mykhailo

Public
Yuqi Zhou Yuqi Zhou ⋅ October 5, 2020

Yes, the answer works well for me. Thanks!

Please sign in or register to submit your answer