Functions map

Hello,

someone could help to write the correct function :

In the main array I have an other array “Tags” and i want to have the sum of all Tag’s name is “Standard - Pas de réponse”, all my functions retunr 0 and i don’t know why :confused:

Hi @Celia_HEINRICH,

Can you show the data of your first module? Because if I understand correctly, you won’t need an Array aggregator, but the use of the map() function instead.
Something like ​​​{{length(map(14.tags; "name"; "Standard - Pas de réponse"))}} (Just copy-paste it in your scenario), Where the first parameter is the mapped value of your tags array

Glenn - Callinetic

Hi thank you for your response,

but it’s not what i want :confused: the function takes the result of the first collection of the array but not the sum :
For exemple in my first array, i have several collections and in each collection i have array “tag” and i would like to calculate the sum of this tags if the name is “Standard - Pas de réponse”, so i tried this formula (bit it retunrs 0) :

{{sum(map(6.array; sum(map(6.array.tags; if(6.array.tags.name = “Standard - Pas de réponse”; 1; 0)))))}}

Yes it’s working without array aggregator but i have a lot of calls every day (more than 400) that’s why i wanted to use agrgregator to reduce the number of opreations.

Hi @Celia_HEINRICH

Can you share the output bundle of array aggregator.

Best regards,

Msquare Automation
Gold Partner of Make
@Msquare_Automation

Sure !

I tried an other function just to have the information of Tags’ Name but its’empty althrough in my output bundle array agreggator there is information in Name :


I would like to calculate the sum of all the array.tags.name = “Standard - Pas de réponse”

[
    {
        "array": [
            {
                "tags": [],
                "number": {
                    "id": 570897,
                    "direct_link": "https://api.aircall.io/v1/numbers/570897",
                    "name": "Digitalsace",
                    "digits": "+33 7 57 90 01 94",
                    "country": "FR",
                    "time_zone": "Europe/Paris",
                    "open": true,
                    "availability_status": "open",
                    "is_ivr": false,
                    "live_recording_activated": true,
                    "priority": null,
                    "messages": {
                        "welcome": "https://media-web.aircall.io/tracks/tts/languages/fr/voices/Celine/7bebe355313a1b5047c14c2c296696176ed97743.mp3",
                        "waiting": "https://media-web.aircall.io/tracks/library/bensound-retrosoul.mp3",
                        "ivr": "https://media-web.aircall.io/tts/languages/fr/voices/Celine/6b3f3f944c14775219565b1d131ffa8baf4dd242.mp3",
                        "voicemail": "https://media-web.aircall.io/tracks/tts/languages/fr/voices/Celine/a0258c535f2d7e49889b51eecf444478066b0d24.mp3",
                        "closed": "https://media-web.aircall.io/tracks/tts/languages/fr/voices/Celine/168496d6c0e115c0e28aa741836cbc5fa8f9678e.mp3",
                        "callback_later": "https://media-web.aircall.io/tts/languages/fr/voices/Celine/f8d1eb9b0a94d84c7c1a0cdc48232e2ae60255ac.mp3",
                        "unanswered_call": "https://media-web.aircall.io/tracks/tts/languages/fr/voices/Celine/a0258c535f2d7e49889b51eecf444478066b0d24.mp3",
                        "after_hours": "https://media-web.aircall.io/tracks/tts/languages/fr/voices/Celine/168496d6c0e115c0e28aa741836cbc5fa8f9678e.mp3",
                        "ringing_tone": "https://media-web.aircall.io/tracks/ringing_tones/EU.mp3"
                    },
                    "created_at": "2023-01-17T08:15:32.000Z"
                }
            },
            {
                "tags": [
                    {
                        "id": 1645089,
                        "name": "OQP / NRP",
                        "created_at": "2024-09-26T06:44:42.000Z",
                        "tagged_by": {
                            "id": 1236007,
                            "direct_link": "https://api.aircall.io/v1/users/1236007",
                            "name": "Kevin LENEGRE",
                            "email": "kevin.lenegre@salestonic.fr",
                            "available": true,
                            "availability_status": "available",
                            "created_at": "2024-02-26T08:44:35.000Z",
                            "time_zone": "Etc/UTC",
                            "language": "fr-FR",
                            "state": "always_opened",
                            "wrap_up_time": 0
                        }
                    }
                ],
                "number": {
                    "id": 570897,
                    "direct_link": "https://api.aircall.io/v1/numbers/570897",
                    "name": "Digitalsace",
                    "digits": "+33 7 57 90 01 94",
                    "country": "FR",
                    "time_zone": "Europe/Paris",
                    "open": true,
                    "availability_status": "open",
                    "is_ivr": false,
                    "live_recording_activated": true,
                    "priority": null,
                    "messages": {
                        "welcome": "https://media-web.aircall.io/tracks/tts/languages/fr/voices/Celine/7bebe355313a1b5047c14c2c296696176ed97743.mp3",
                        "waiting": "https://media-web.aircall.io/tracks/library/bensound-retrosoul.mp3",
                        "ivr": "https://media-web.aircall.io/tts/languages/fr/voices/Celine/6b3f3f944c14775219565b1d131ffa8baf4dd242.mp3",
                        "voicemail": "https://media-web.aircall.io/tracks/tts/languages/fr/voices/Celine/a0258c535f2d7e49889b51eecf444478066b0d24.mp3",
                        "closed": "https://media-web.aircall.io/tracks/tts/languages/fr/voices/Celine/168496d6c0e115c0e28aa741836cbc5fa8f9678e.mp3",
                        "callback_later": "https://media-web.aircall.io/tts/languages/fr/voices/Celine/f8d1eb9b0a94d84c7c1a0cdc48232e2ae60255ac.mp3",
                        "unanswered_call": "https://media-web.aircall.io/tracks/tts/languages/fr/voices/Celine/a0258c535f2d7e49889b51eecf444478066b0d24.mp3",
                        "after_hours": "https://media-web.aircall.io/tracks/tts/languages/fr/voices/Celine/168496d6c0e115c0e28aa741836cbc5fa8f9678e.mp3",
                        "ringing_tone": "https://media-web.aircall.io/tracks/ringing_tones/EU.mp3"
                    },
                    "created_at": "2023-01-17T08:15:32.000Z"
                }
            }
        ],
        "__IMTAGGLENGTH__": 2
    }
]

it was the solution , i had ti use the flatten function

1 Like