Optimize Paring Values Of Two Items

Hi,

I’m utilizing two item values from the Jotform - List A Form Questions module to generate a URL in a Compose A String module. My current solution requires four steps to manipulate the data.

The data transformation process pairs the value of the Text and Name items together, making them available for use within the Compose A String module.

I would welcome any suggestions for different approaches to accomplish this task. Screenshots, Bundle output, ideal input, and blueprint below.

jotform_output.json (58.6 KB)

ideal_output.json (6.8 KB)

blueprint.json (15.5 KB)

Welcome to the Make community!

You can use the built-in function toCollection

e.g.:

{{toCollection(83.array; "name"; "text")}}

Output

Screenshot_2024-05-03_110519


Here are some useful links and guides you can use to learn more on how to use the Make platform, apps, and app modules. I found these useful when I was learning Make, and hope they might benefit you too —

General

Help Center Basics

Articles & Videos

Partner & Custom Apps

samliewrequest private consultation

Join the Make unofficial Discord server!

2 Likes

Slick solution @samliew! I slightly updated the function to reorder the values.

{{toCollection(83.array; "name"; "text")}}

I’m now noticing the nested values under the sublabels key. Could you suggest how to make them available to the Compose A String module along with the name text collection? For example:

    {
        "compoundHint": "",
        "customStateOptions": "",
        "description": "",
        "labelAlign": "Auto",
        "name": "address1",
        "order": "41",
        "qid": "5",
        "required": "No",
        "requiredInputs": "",
        "requirePostal": "",
        "selectedCountry": "",
        "shrink": "No",
        "states": "textbox",
        "subfields": "|state|st1|st2|city|zip|country",
        "sublabels": {
            "addr_line1": "Street Address",
            "addr_line2": "Street Address Line 2",
            "city": "City",
            "state": "State / Province",
            "postal": "Postal / Zip Code",
            "country": "Country"
        }

To

    {
        "collection": {
            "Street Address": "address1[addr_line1]"`
        }
    }

Sublabels is not an array, so you can just map the children property variables directly.

2 Likes

@samliew There are multiple sublabels that I don’t see in the picker. Should I turn them into an array or something first?

If I add them to the aggregator I see

            {
                "name": "address1",
                "text": "Address 1",
                "sublabels": {
                    "addr_line1": "Street Address",
                    "addr_line2": "Street Address Line 2",
                    "city": "City",
                    "state": "State / Province",
                    "postal": "Postal / Zip Code",
                    "country": "Country"
                },
            {
                "name": "address39",
                "text": "Address 2",
                "sublabels": {
                    "addr_line1": "Street Address",
                    "addr_line2": "Street Address Line 2",
                    "city": "City",
                    "state": "State / Province",
                    "postal": "Postal / Zip Code",
                    "country": "Country"
                }
            },
            {
                "name": "address40",
                "text": "Address 3",
                "sublabels": {
                    "addr_line1": "Street Address",
                    "addr_line2": "Street Address Line 2",
                    "city": "City",
                    "state": "State / Province",
                    "postal": "Postal / Zip Code",
                    "country": "Country"
                }

In that case you’ll need another Set Multiple Variables module

To get address1 sublabels, You can use the built-in function map and first

e.g.:

{{ first(map(83.array; "sublabels"; "name"; "address1")) }}

For more information, see

2 Likes