Confused with arrays / collections

Hi Make community,

i’m a new Make.com user, and i’m trying to show some data from online orders.

My scenario is this

My current scenario gives me a list of orders like this

Capture d’écran 2024-02-12 à 16.39.40

The result of each operation is like this

My purpose is to have a the end an email with text showing

the list of orders (Reference) containing missing articles (that is to say articles where qteManquanteArticle is > 0),

and for each of these orders
the list of the missing articles & corresponding missing quantity qteManquanteArticle

It might be quite simple, but i’m confused with arrays, collections, aggregators and can’t manage to get it !

Here is the example of a bundle output (which corresponds to an order).

Thank you very much for your help !

[
    {
        "total": 1,
        "commandes": [
            {
                "entrepotNom": "Le Mans",
                "bloquee": false,
                "blocageLogistique": false,
                "listeMotifBlocageLogistique": [],
                "motifBlocage": null,
                "messageCadeau": null,
                "referenceEKAN": "EK050224438904",
                "reference": "C-240212-13373",
                "referenceSecondaire": null,
                "referenceClient": null,
                "dateCreation": "2024-02-12T08:40:29+01:00",
                "etat": "ATTENTE_STOCK",
                "etatLibelle": "En attente de stock",
                "dateCommande": "2024-02-12T00:00:00+01:00",
                "dateExpeditionSouhaitee": null,
                "etatPaiement": 1,
                "etatPaiementLibelle": "Payé",
                "montantToAssurer": null,
                "montantHT": null,
                "deviseMontantHT": "EUR",
                "incoterm": null,
                "categorieEnvoi": null,
                "fraisDePort": null,
                "deviseFraisDePort": "EUR",
                "messageCommercial": null,
                "commentaire": "%%IdCde46988765IdCde%%",
                "dateModification": "2024-02-12T08:41:58+01:00",
                "hasDocument": false,
                "hasFacture": false,
                "hasFormulaire": false,
                "factureNecessaire": false,
                "commandeMere": null,
                "client": {
                    "nom": "Grégoire",
                    "prenom": "Isabelle",
                    "reference": "",
                    "typeClient": "Entreprise",
                    "codeTypeClient": "ENTREPRISE"
                },
                "serviceTransporteur": {
                    "nom": "DPD",
                    "code": "39",
                    "transporteur": {
                        "nom": "DPD",
                        "code": "DPD"
                    }
                },
                "infoFacturation": {
                    "nom": "Grégoire",
                    "prenom": "Isabelle",
                    "etageCouloirEscalier": null,
                    "adresse": "Avenue du Vivier d'Oie 75",
                    "ville": "Bruxelles",
                    "codePostal": "1000",
                    "codePays": "BE",
                    "entreeBatimentImmeuble": null,
                    "adresseSecondaire": null,
                    "telephoneFixe": null,
                    "telephoneMobile": null,
                    "email": "isabelle@society.be"
                },
                "infoLivraison": {
                    "societe": "La Villa Traiteur",
                    "nom": "Villa",
                    "prenom": "Marie",
                    "telephoneFixe": "+32471777925",
                    "telephoneMobile": "+32477736925",
                    "email": "traiteur@villa.be",
                    "etageCouloirEscalier": null,
                    "entreeBatimentImmeuble": null,
                    "adresse": "Place Dumon 33",
                    "adresseSecondaire": null,
                    "codePostal": "1150",
                    "ville": "Bruxelles Woluwe-Saint-Pierre",
                    "codePays": "BE",
                    "nrPointDepot": null,
                    "commentaire": "HORAIRES LIVRAISON lun-ven : 10h30-19h"
                },
                "details": [
                    {
                        "article": {
                            "titre": "Biscuits sablés Bio aux 3 Poivres - 35g",
                            "refEcommercant": "BIP004",
                            "EAN13": "3760243072543",
                            "taille": null,
                            "couleur": null,
                            "marque": "SUPERP "
                        },
                        "qteCommandeArticle": 1,
                        "qteManquanteArticle": 0,
                        "dlc": "",
                        "nrSerie": null,
                        "pack": null,
                        "prixVenteUnitaire": null,
                        "devisePrixVenteUnitaire": "EUR",
                        "emballageCadeau": false,
                        "remarque": null
                    },
                    {
                        "article": {
                            "titre": "Menu de saison Superproducteur - Automne",
                            "refEcommercant": "MDS001",
                            "EAN13": null,
                            "taille": null,
                            "couleur": null,
                            "marque": null
                        },
                        "qteCommandeArticle": 1,
                        "qteManquanteArticle": 0,
                        "dlc": "",
                        "nrSerie": null,
                        "pack": null,
                        "prixVenteUnitaire": null,
                        "devisePrixVenteUnitaire": "EUR",
                        "emballageCadeau": false,
                        "remarque": null
                    },
                    {
                        "article": {
                            "titre": "Crème Fine Bio d'Artichauts - 100g",
                            "refEcommercant": "ARB002",
                            "EAN13": "3760243070969",
                            "taille": null,
                            "couleur": null,
                            "marque": null
                        },
                        "qteCommandeArticle": 36,
                        "qteManquanteArticle": 0,
                        "dlc": "",
                        "nrSerie": null,
                        "pack": null,
                        "prixVenteUnitaire": null,
                        "devisePrixVenteUnitaire": "EUR",
                        "emballageCadeau": false,
                        "remarque": null
                    },
                    {
                        "article": {
                            "titre": "Rillettes de Saint Jacques 90g",
                            "refEcommercant": "SAB001",
                            "EAN13": "3760243070617",
                            "taille": null,
                            "couleur": null,
                            "marque": "SUPERP"
                        },
                        "qteCommandeArticle": 12,
                        "qteManquanteArticle": 12,
                        "dlc": "",
                        "nrSerie": null,
                        "pack": null,
                        "prixVenteUnitaire": null,
                        "devisePrixVenteUnitaire": "EUR",
                        "emballageCadeau": false,
                        "remarque": null
                    },
                    {
                        "article": {
                            "titre": "Rillettes de Langoustines - 90g",
                            "refEcommercant": "LAN002",
                            "EAN13": "3760243071195",
                            "taille": null,
                            "couleur": null,
                            "marque": "Superp"
                        },
                        "qteCommandeArticle": 12,
                        "qteManquanteArticle": 0,
                        "dlc": "",
                        "nrSerie": null,
                        "pack": null,
                        "prixVenteUnitaire": null,
                        "devisePrixVenteUnitaire": "EUR",
                        "emballageCadeau": false,
                        "remarque": null
                    }
                ]
            }
        ]
    }
]

1. Iterate Commandes, Set variable

Input: 5 details

Output: 1

2. Iterate Details, Text aggregate

Screenshot_2024-02-13_150229

Output:

Screenshot_2024-02-13_150245

3. Combine

Output

Screenshot_2024-02-13_150238

samliewrequest private consultation

2 Likes

You can copy and paste this module export into your scenario. This will paste the modules shown in my screenshots above.

  1. Copy the code below by clicking the copy button when you mouseover the top-right of the code block
    Screenshot_2024-01-17_200117

  2. Enter your scenario editor. Press ESC to close any dialogs. Press CTRLV to paste in the canvas.

  3. Replace first module with your module [12].

  4. Click on each imported module and save it. You may need to remap some variables.

Modules JSON Export

{
    "subflows": [
        {
            "flow": [
                {
                    "id": 26,
                    "module": "json:ParseJSON",
                    "version": 1,
                    "parameters": {
                        "type": ""
                    },
                    "mapper": {
                        "json": "[\n    {\n        \"total\": 1,\n        \"commandes\": [\n            {\n                \"entrepotNom\": \"Le Mans\",\n                \"bloquee\": false,\n                \"blocageLogistique\": false,\n                \"listeMotifBlocageLogistique\": [],\n                \"motifBlocage\": null,\n                \"messageCadeau\": null,\n                \"referenceEKAN\": \"EK050224438904\",\n                \"reference\": \"C-240212-13373\",\n                \"referenceSecondaire\": null,\n                \"referenceClient\": null,\n                \"dateCreation\": \"2024-02-12T08:40:29+01:00\",\n                \"etat\": \"ATTENTE_STOCK\",\n                \"etatLibelle\": \"En attente de stock\",\n                \"dateCommande\": \"2024-02-12T00:00:00+01:00\",\n                \"dateExpeditionSouhaitee\": null,\n                \"etatPaiement\": 1,\n                \"etatPaiementLibelle\": \"Payé\",\n                \"montantToAssurer\": null,\n                \"montantHT\": null,\n                \"deviseMontantHT\": \"EUR\",\n                \"incoterm\": null,\n                \"categorieEnvoi\": null,\n                \"fraisDePort\": null,\n                \"deviseFraisDePort\": \"EUR\",\n                \"messageCommercial\": null,\n                \"commentaire\": \"%%IdCde46988765IdCde%%\",\n                \"dateModification\": \"2024-02-12T08:41:58+01:00\",\n                \"hasDocument\": false,\n                \"hasFacture\": false,\n                \"hasFormulaire\": false,\n                \"factureNecessaire\": false,\n                \"commandeMere\": null,\n                \"client\": {\n                    \"nom\": \"Grégoire\",\n                    \"prenom\": \"Isabelle\",\n                    \"reference\": \"\",\n                    \"typeClient\": \"Entreprise\",\n                    \"codeTypeClient\": \"ENTREPRISE\"\n                },\n                \"serviceTransporteur\": {\n                    \"nom\": \"DPD\",\n                    \"code\": \"39\",\n                    \"transporteur\": {\n                        \"nom\": \"DPD\",\n                        \"code\": \"DPD\"\n                    }\n                },\n                \"infoFacturation\": {\n                    \"nom\": \"Grégoire\",\n                    \"prenom\": \"Isabelle\",\n                    \"etageCouloirEscalier\": null,\n                    \"adresse\": \"Avenue du Vivier d'Oie 75\",\n                    \"ville\": \"Bruxelles\",\n                    \"codePostal\": \"1000\",\n                    \"codePays\": \"BE\",\n                    \"entreeBatimentImmeuble\": null,\n                    \"adresseSecondaire\": null,\n                    \"telephoneFixe\": null,\n                    \"telephoneMobile\": null,\n                    \"email\": \"isabelle@society.be\"\n                },\n                \"infoLivraison\": {\n                    \"societe\": \"La Villa Traiteur\",\n                    \"nom\": \"Villa\",\n                    \"prenom\": \"Marie\",\n                    \"telephoneFixe\": \"+32471777925\",\n                    \"telephoneMobile\": \"+32477736925\",\n                    \"email\": \"traiteur@villa.be\",\n                    \"etageCouloirEscalier\": null,\n                    \"entreeBatimentImmeuble\": null,\n                    \"adresse\": \"Place Dumon 33\",\n                    \"adresseSecondaire\": null,\n                    \"codePostal\": \"1150\",\n                    \"ville\": \"Bruxelles Woluwe-Saint-Pierre\",\n                    \"codePays\": \"BE\",\n                    \"nrPointDepot\": null,\n                    \"commentaire\": \"HORAIRES LIVRAISON lun-ven : 10h30-19h\"\n                },\n                \"details\": [\n                    {\n                        \"article\": {\n                            \"titre\": \"Biscuits sablés Bio aux 3 Poivres - 35g\",\n                            \"refEcommercant\": \"BIP004\",\n                            \"EAN13\": \"3760243072543\",\n                            \"taille\": null,\n                            \"couleur\": null,\n                            \"marque\": \"SUPERP \"\n                        },\n                        \"qteCommandeArticle\": 1,\n                        \"qteManquanteArticle\": 0,\n                        \"dlc\": \"\",\n                        \"nrSerie\": null,\n                        \"pack\": null,\n                        \"prixVenteUnitaire\": null,\n                        \"devisePrixVenteUnitaire\": \"EUR\",\n                        \"emballageCadeau\": false,\n                        \"remarque\": null\n                    },\n                    {\n                        \"article\": {\n                            \"titre\": \"Menu de saison Superproducteur - Automne\",\n                            \"refEcommercant\": \"MDS001\",\n                            \"EAN13\": null,\n                            \"taille\": null,\n                            \"couleur\": null,\n                            \"marque\": null\n                        },\n                        \"qteCommandeArticle\": 1,\n                        \"qteManquanteArticle\": 0,\n                        \"dlc\": \"\",\n                        \"nrSerie\": null,\n                        \"pack\": null,\n                        \"prixVenteUnitaire\": null,\n                        \"devisePrixVenteUnitaire\": \"EUR\",\n                        \"emballageCadeau\": false,\n                        \"remarque\": null\n                    },\n                    {\n                        \"article\": {\n                            \"titre\": \"Crème Fine Bio d'Artichauts - 100g\",\n                            \"refEcommercant\": \"ARB002\",\n                            \"EAN13\": \"3760243070969\",\n                            \"taille\": null,\n                            \"couleur\": null,\n                            \"marque\": null\n                        },\n                        \"qteCommandeArticle\": 36,\n                        \"qteManquanteArticle\": 0,\n                        \"dlc\": \"\",\n                        \"nrSerie\": null,\n                        \"pack\": null,\n                        \"prixVenteUnitaire\": null,\n                        \"devisePrixVenteUnitaire\": \"EUR\",\n                        \"emballageCadeau\": false,\n                        \"remarque\": null\n                    },\n                    {\n                        \"article\": {\n                            \"titre\": \"Rillettes de Saint Jacques 90g\",\n                            \"refEcommercant\": \"SAB001\",\n                            \"EAN13\": \"3760243070617\",\n                            \"taille\": null,\n                            \"couleur\": null,\n                            \"marque\": \"SUPERP\"\n                        },\n                        \"qteCommandeArticle\": 12,\n                        \"qteManquanteArticle\": 12,\n                        \"dlc\": \"\",\n                        \"nrSerie\": null,\n                        \"pack\": null,\n                        \"prixVenteUnitaire\": null,\n                        \"devisePrixVenteUnitaire\": \"EUR\",\n                        \"emballageCadeau\": false,\n                        \"remarque\": null\n                    },\n                    {\n                        \"article\": {\n                            \"titre\": \"Rillettes de Langoustines - 90g\",\n                            \"refEcommercant\": \"LAN002\",\n                            \"EAN13\": \"3760243071195\",\n                            \"taille\": null,\n                            \"couleur\": null,\n                            \"marque\": \"Superp\"\n                        },\n                        \"qteCommandeArticle\": 12,\n                        \"qteManquanteArticle\": 0,\n                        \"dlc\": \"\",\n                        \"nrSerie\": null,\n                        \"pack\": null,\n                        \"prixVenteUnitaire\": null,\n                        \"devisePrixVenteUnitaire\": \"EUR\",\n                        \"emballageCadeau\": false,\n                        \"remarque\": null\n                    }\n                ]\n            }\n        ]\n    }\n]"
                    },
                    "metadata": {
                        "designer": {
                            "x": 157,
                            "y": -1336,
                            "name": "Output bundle"
                        },
                        "restore": {
                            "parameters": {
                                "type": {
                                    "label": "Choose a data structure"
                                }
                            }
                        },
                        "parameters": [
                            {
                                "name": "type",
                                "type": "udt",
                                "label": "Data structure"
                            }
                        ],
                        "expect": [
                            {
                                "name": "json",
                                "type": "text",
                                "label": "JSON string",
                                "required": true
                            }
                        ]
                    }
                },
                {
                    "id": 28,
                    "module": "builtin:BasicFeeder",
                    "version": 1,
                    "parameters": {},
                    "mapper": {
                        "array": "{{26.commandes}}"
                    },
                    "metadata": {
                        "designer": {
                            "x": 400,
                            "y": -1337,
                            "name": "Iterate Commandes"
                        },
                        "restore": {
                            "expect": {
                                "array": {
                                    "mode": "edit"
                                }
                            }
                        },
                        "expect": [
                            {
                                "name": "array",
                                "type": "array",
                                "label": "Array",
                                "mode": "edit",
                                "spec": []
                            }
                        ]
                    }
                },
                {
                    "id": 27,
                    "module": "util:SetVariables",
                    "version": 1,
                    "parameters": {},
                    "mapper": {
                        "variables": [
                            {
                                "name": "numQteManquanteArticle",
                                "value": "{{length(28.details) - \"\n\"}}{{length(map(28.details; \"qteManquanteArticle\"; \"qteManquanteArticle\"; 0))}}"
                            }
                        ],
                        "scope": "roundtrip"
                    },
                    "metadata": {
                        "designer": {
                            "x": 645,
                            "y": -1336
                        },
                        "restore": {
                            "expect": {
                                "variables": {
                                    "items": [
                                        null
                                    ]
                                },
                                "scope": {
                                    "label": "One cycle"
                                }
                            }
                        },
                        "expect": [
                            {
                                "name": "variables",
                                "type": "array",
                                "label": "Variables",
                                "spec": [
                                    {
                                        "name": "name",
                                        "label": "Variable name",
                                        "type": "text",
                                        "required": true
                                    },
                                    {
                                        "name": "value",
                                        "label": "Variable value",
                                        "type": "any"
                                    }
                                ]
                            },
                            {
                                "name": "scope",
                                "type": "select",
                                "label": "Variable lifetime",
                                "required": true,
                                "validate": {
                                    "enum": [
                                        "roundtrip",
                                        "execution"
                                    ]
                                }
                            }
                        ],
                        "interface": [
                            {
                                "name": "numQteManquanteArticle",
                                "label": "numQteManquanteArticle",
                                "type": "any"
                            }
                        ]
                    }
                },
                {
                    "id": 30,
                    "module": "builtin:BasicFeeder",
                    "version": 1,
                    "parameters": {},
                    "mapper": {
                        "array": "{{28.details}}"
                    },
                    "metadata": {
                        "designer": {
                            "x": 888,
                            "y": -1331,
                            "name": "Iterate Details"
                        },
                        "restore": {
                            "expect": {
                                "array": {
                                    "mode": "edit"
                                }
                            }
                        },
                        "expect": [
                            {
                                "name": "array",
                                "type": "array",
                                "label": "Array",
                                "mode": "edit",
                                "spec": []
                            }
                        ]
                    }
                },
                {
                    "id": 31,
                    "module": "util:TextAggregator",
                    "version": 1,
                    "parameters": {
                        "rowSeparator": "\n",
                        "feeder": 30
                    },
                    "mapper": {
                        "value": "Titre: {{30.article.titre}}; Manquante: {{30.qteCommandeArticle}}"
                    },
                    "metadata": {
                        "designer": {
                            "x": 1132,
                            "y": -1331
                        },
                        "restore": {
                            "parameters": {
                                "rowSeparator": {
                                    "label": "New row"
                                }
                            },
                            "extra": {
                                "feeder": {
                                    "label": "Iterate Details [30]"
                                }
                            },
                            "flags": {
                                "groupBy": {
                                    "collapsed": true
                                },
                                "stopIfEmpty": {
                                    "collapsed": true
                                }
                            }
                        },
                        "parameters": [
                            {
                                "name": "rowSeparator",
                                "type": "select",
                                "label": "Row separator",
                                "validate": {
                                    "enum": [
                                        "\n",
                                        "\t",
                                        "other"
                                    ]
                                }
                            }
                        ],
                        "expect": [
                            {
                                "name": "value",
                                "type": "text",
                                "label": "Text"
                            }
                        ],
                        "advanced": true
                    }
                },
                {
                    "id": 32,
                    "module": "util:ComposeTransformer",
                    "version": 1,
                    "parameters": {},
                    "mapper": {
                        "value": "REPORT\n\nNum Qte Manquante Article: {{27.numQteManquanteArticle}}\n\nDetails:\n{{31.text}}"
                    },
                    "metadata": {
                        "designer": {
                            "x": 1380,
                            "y": -1336,
                            "messages": [
                                {
                                    "category": "last",
                                    "severity": "warning",
                                    "message": "A transformer should not be the last module in the route."
                                }
                            ]
                        },
                        "restore": {},
                        "expect": [
                            {
                                "name": "value",
                                "type": "text",
                                "label": "Text"
                            }
                        ]
                    }
                }
            ]
        }
    ],
    "metadata": {
        "version": 1
    }
}
2 Likes