How to use Map function in this instance

Hey there, I have a scenario with a lot of routers and the filters for it depends upon whether certain tag exists for a user or not, what I realized is the order of tags keeps changing so my filter isn’t working properly, so what can I do in such situation, I tried using map function but that didn’t work.

This is the input data, the tag name changes its order depending on how many tags exist here

What do you need as output from tags assuming tags is an object?

This object mapping technique is gold. But it’s only used to extract an array of specific items from an object.

So the output I need from the tags array is the tag name, only the tag name shows up under the array, no ID or anything I can use to filter, I’ll show the screenshot of the input data

This was the map function I used but it didn’t work

Variable Name- Booked Intake
{{get(map(34.tags; "text"; "text"; "Booked Intake"); 1)}}

I just want to use filters like if Booked Intake variable exists then Route 1, if not then Route 2.

Can you show your output bundle from the active campaign module. It’s available in the little operations bubble and you can download the output bundle using the icon with a little down arrow.

Here is the output bundle

[
    {
        "id": "1868",
        "cdate": "2022-10-11 12:53:25",
        "email": "fahadsheji@outlook.in",
        "phone": "+91 73062 21397",
        "first_name": "Fahad",
        "last_name": "Test14",
        "customer_acct_id": "0",
        "customer_acct_name": "",
        "segmentio_id": "",
        "bounced_hard": "0",
        "bounced_soft": "0",
        "bounced_date": "0000-00-00",
        "ip": "0.0.0.0",
        "ua": "",
        "hash": "e7a711409d4f4d673b66a933b4d4c924",
        "socialdata_lastcheck": "0000-00-00 00:00:00",
        "email_local": "",
        "email_domain": "outlook.in",
        "sentcnt": "0",
        "rating": "1",
        "rating_tstamp": "0000-00-00",
        "gravatar": "0",
        "deleted": "0",
        "anonymized": "0",
        "adate": "2022-10-13 16:06:11",
        "udate": "",
        "edate": "2022-10-13 15:32:19",
        "deleted_at": "0000-00-00 00:00:00",
        "created_utc_timestamp": "2022-10-11 12:53:25",
        "updated_utc_timestamp": "2022-10-14 05:49:28",
        "created_timestamp": "2022-10-11 12:53:25",
        "updated_timestamp": "2022-10-14 05:49:28",
        "created_by": "0",
        "updated_by": "0",
        "email_empty": "0",
        "mpp_tracking": "0",
        "name": "Fahad Test14",
        "lists": [],
        "listslist": "",
        "fields": [
            {
                "id": "1",
                "title": "City",
                "descript": null,
                "type": "text",
                "isrequired": "0",
                "perstag": "CITY",
                "defval": null,
                "show_in_list": "0",
                "rows": "0",
                "cols": "0",
                "visible": "1",
                "service": "",
                "ordernum": "0",
                "cdate": null,
                "udate": null,
                "created_timestamp": "2022-06-13 16:19:21",
                "updated_timestamp": "2022-06-13 16:19:21",
                "created_by": null,
                "updated_by": null,
                "val": null,
                "relid": "0",
                "dataid": "0",
                "element": "text",
                "tag": "%CITY%"
            },
            {
                "id": "2",
                "title": "State",
                "descript": null,
                "type": "text",
                "isrequired": "0",
                "perstag": "STATE",
                "defval": null,
                "show_in_list": "0",
                "rows": "0",
                "cols": "0",
                "visible": "1",
                "service": "",
                "ordernum": "0",
                "cdate": null,
                "udate": null,
                "created_timestamp": "2022-06-13 16:19:36",
                "updated_timestamp": "2022-06-13 16:19:36",
                "created_by": null,
                "updated_by": null,
                "val": null,
                "relid": "0",
                "dataid": "0",
                "element": "text",
                "tag": "%STATE%"
            },
            {
                "id": "3",
                "title": "ZIP",
                "descript": null,
                "type": "text",
                "isrequired": "0",
                "perstag": "ZIP",
                "defval": null,
                "show_in_list": "0",
                "rows": "0",
                "cols": "0",
                "visible": "1",
                "service": "",
                "ordernum": "0",
                "cdate": null,
                "udate": null,
                "created_timestamp": "2022-06-13 16:19:49",
                "updated_timestamp": "2022-06-13 16:19:49",
                "created_by": null,
                "updated_by": null,
                "val": null,
                "relid": "0",
                "dataid": "0",
                "element": "text",
                "tag": "%ZIP%"
            },
            {
                "id": "4",
                "title": "Contact Income",
                "descript": "",
                "type": "text",
                "isrequired": "0",
                "perstag": "CONTACT_INCOME",
                "defval": "",
                "show_in_list": "0",
                "rows": "0",
                "cols": "0",
                "visible": "1",
                "service": "",
                "ordernum": "1",
                "cdate": "2022-06-30 19:49:38",
                "udate": "2022-06-30 19:49:38",
                "created_timestamp": "2022-06-30 19:49:38",
                "updated_timestamp": "2022-06-30 19:49:38",
                "created_by": "1",
                "updated_by": "1",
                "val": null,
                "relid": "0",
                "dataid": "0",
                "element": "text",
                "tag": "%CONTACT_INCOME%"
            },
            {
                "id": "5",
                "title": "Spouse Income",
                "descript": "",
                "type": "text",
                "isrequired": "0",
                "perstag": "SPOUSE_INCOME",
                "defval": "",
                "show_in_list": "0",
                "rows": "0",
                "cols": "0",
                "visible": "1",
                "service": "",
                "ordernum": "2",
                "cdate": "2022-06-30 19:49:54",
                "udate": "2022-06-30 19:49:54",
                "created_timestamp": "2022-06-30 19:49:54",
                "updated_timestamp": "2022-06-30 19:49:54",
                "created_by": "1",
                "updated_by": "1",
                "val": null,
                "relid": "0",
                "dataid": "0",
                "element": "text",
                "tag": "%SPOUSE_INCOME%"
            },
            {
                "id": "6",
                "title": "Start Time",
                "descript": "",
                "type": "text",
                "isrequired": "0",
                "perstag": "START_TIME",
                "defval": "",
                "show_in_list": "0",
                "rows": "0",
                "cols": "0",
                "visible": "1",
                "service": "",
                "ordernum": "3",
                "cdate": "2022-07-20 15:22:55",
                "udate": "2022-07-20 15:22:55",
                "created_timestamp": "2022-07-20 15:22:56",
                "updated_timestamp": "2022-07-20 15:22:56",
                "created_by": "1",
                "updated_by": "1",
                "val": "2022-10-17T11:30:00-04:00",
                "relid": "0",
                "dataid": "3087",
                "element": "text",
                "tag": "%START_TIME%"
            },
            {
                "id": "7",
                "title": "Campaign Source",
                "descript": "",
                "type": "text",
                "isrequired": "0",
                "perstag": "CAMPAIGN_SOURCE",
                "defval": "",
                "show_in_list": "0",
                "rows": "0",
                "cols": "0",
                "visible": "1",
                "service": "",
                "ordernum": "4",
                "cdate": "2022-07-26 15:40:48",
                "udate": "2022-07-26 15:40:48",
                "created_timestamp": "2022-07-26 15:40:48",
                "updated_timestamp": "2022-07-26 15:40:48",
                "created_by": "2",
                "updated_by": "2",
                "val": "",
                "relid": "0",
                "dataid": "3031",
                "element": "text",
                "tag": "%CAMPAIGN_SOURCE%"
            },
            {
                "id": "8",
                "title": "Lead Source",
                "descript": "",
                "type": "text",
                "isrequired": "0",
                "perstag": "LEAD_SOURCE",
                "defval": "",
                "show_in_list": "0",
                "rows": "0",
                "cols": "0",
                "visible": "1",
                "service": "",
                "ordernum": "5",
                "cdate": "2022-07-26 16:59:20",
                "udate": "2022-07-26 16:59:20",
                "created_timestamp": "2022-07-26 16:59:20",
                "updated_timestamp": "2022-07-26 16:59:20",
                "created_by": "2",
                "updated_by": "2",
                "val": "Facebook",
                "relid": "0",
                "dataid": "3030",
                "element": "text",
                "tag": "%LEAD_SOURCE%"
            }
        ],
        "actions": [],
        "automation_history": [],
        "campaign_history": [],
        "listid": 0,
        "lid": 0,
        "subscriberid": "1868",
        "formid": 0,
        "status": 1,
        "sdate": "2022-10-11 12:53:25",
        "ip4_sub": 0,
        "ip4_unsub": 0,
        "ip4_last": 0,
        "ip4": "0.0.0.0",
        "sourceid": 0,
        "bounces": {
            "mailing": [],
            "mailings": 0,
            "responder": [],
            "responders": 0
        },
        "bouncescnt": 0,
        "tags": [
            "calendly-integration",
            "calendly-integration-30_Minute_Meeting",
            "Fb Lead Ads",
            "Booked Intake"
        ],
        "orgid": "0",
        "orgname": "",
        "result_code": 1,
        "result_message": "Success: Something is returned",
        "result_output": "json",
        "customFields": {
            "CITY": null,
            "STATE": null,
            "ZIP": null,
            "CONTACT_INCOME": null,
            "SPOUSE_INCOME": null,
            "START_TIME": "2022-10-17T11:30:00-04:00",
            "CAMPAIGN_SOURCE": "",
            "LEAD_SOURCE": "Facebook"
        }
    }
]

Ok so tags is just an array. You can search an array for value using an array function.

Contains() will work.

1 Like

Thanks that worked

.