Extract Answers from a Collection on Gravity Forms

Hi there!

I’ve been checking around and there seems to be no specific answer to my issue:

[
    {
        "answers": {
            "1": {
                "1.3": "First Name",
                "1.6": "Last Name"
            },
            "2": "Phone",
            "3": "Email",
            "4": "Service Needs",
            "6": "",
            "10": {
                "10.1": "Address",
                "10.3": "City",
                "10.4": "State",
                "10.5": "Zip",
                "10.6": "Country",
                "10.2": ""
            },
            "11": "Residential",
            "13": {
                "13.2": "Service A",
                "13.1": "",
                "13.3": "",
                "13.4": "",
                "13.5": "Service D",
                "13.6": "",
                "13.7": "",
                "13.8": "",
                "13.9": "",
                "13.11": "Service 12",
                "13.12": "",
                "13.13": ""
            },
            "14": "Yes please",
            "15": {
                "15.7": "Saw us around town",
                "15.1": "",
                "15.2": "",
                "15.3": "",
                "15.4": "",
                "15.5": "",
                "15.6": "",
                "15.8": "",
                "15.9": ""
            },
            "16": "Phone only",
            "17": "Remove everything, including cleaning up any debris",
            "18": {
                "18.5": "Information",
                "18.1": "",
                "18.2": "",
                "18.3": "",
                "18.4": "",
                "18.6": "",
                "18.7": "",
                "18.8": ""
            },
            "20": [],
            "21": "",
            "24": "Yes",
            "25": ""
        },
        "metadata": {
            "id": "1827",
            "form_id": "1",
            "post_id": null,
            "date_created": "2024-07-23T19:55:06.000Z",
            "date_updated": "2024-07-23T19:55:06.000Z",
            "is_starred": "0",
            "is_read": "0",
            "currency": "USD",
            "payment_status": null,
            "payment_date": null,
            "payment_amount": null,
            "payment_method": null,
            "transaction_id": null,
            "is_fulfilled": null,
            "created_by": null,
            "transaction_type": null,
            "status": "active"
        }
    }
]

Main goal here is to pull the answers from #13 but of course format it in a way that it makes sense like “Service A, Service D, Service 12”

I tried to use the replace function but I get results like this: , Service A, , , Service D, , Service 12, , ,

{{replace(1.answers.13.13.1 + ", " + 1.answers.13.13.2 + ", " + 1.answers.13.13.3 + ", " + 1.answers.13.13.4 + ", " + 1.answers.13.13.5 + ", " + 1.answers.13.13.6 + ", " + 1.answers.13.13.7 + ", " + 1.answers.13.13.8 + ", " + 1.answers.13.13.9 + ", " + 1.answers.13.13.11 + ", " + 1.answers.13.13.12 + ", " + 1.answers.13.13.13; newline; ", ")}}

Hi,

You can use a simple method to implement this:

  1. Use the “Iterator module”
    SC_1

  2. Next set up a filter
    SC_2

  3. And configure “Text Aggregator”

or go with more advanced one using functions which can help you save operations:
SC_4

{{join(remove(map(toArray(10.answers.`13`); "value"); emptystring); ",")}}

SC_5

Hope it helps!

Have a nice day,
Michal
Simplymation

1 Like