Counting the value of all Bundle to Google Sheet

I have this output:

At each bundle, have TAGS collections:
image
image

You see, some TAGS have 2 tags collections, some TAG have 3-4-5 tags collections.

I want to out put to Google Sheet like this
image

How can i count the TAGS Collections which have id = 34, 2, 9, … to each column in 1 row?

Thank you so much!

Welcome to the Make community!

Please provide the output bundle of the first screenshot by running the scenario, then click the white speech bubble on the top-right of each module and select “Download output bundles”.
Screenshot_2023-10-06_141025

A.

Save the bundle contents in your text editor as a bundle.txt file, and upload it here into this discussion thread.

Uploading it here will look like this:

bundle.txt (12.3 KB)

B.

If you are unable to upload files on this forum, alternatively you can paste the formatted output bundle in this manner:

  • Either add three backticks ``` before and after the code, like this:

    ```
    input/output bundle content goes here
    ```

  • Or use the format code button in the editor:
    Screenshot_2023-10-02_191027

Providing the output bundles will allow others to replicate what is going on in the scenario even if they do not use the external service.

Following these steps will allow others to assist you here. Thanks!

samliewrequest private consultation

Join the unofficial Make Discord server to chat with us!

1 Like

bundle.txt (547.6 KB)

Thank you for your help!

Welcome to the Make community!

Yes, that is possible. You’ll need a minimum of four modules:

(last module is optional)

Output

Screenshot_2024-05-25_051121

Give it a go and let us know if you have any issues!

Welcome to the Make community!

Screenshot_2024-02-20_151445

You can use a Text Parser “Match Pattern” module with this Pattern (regular expression):

"id":(?<tag_id>\d+),"lighten_color"

Proof

https://regex101.com/r/R67MRX

Important Info

  • :warning: Global match must be set to YES!

For more information, see Text Parser in the Make Help Center:

Match Pattern
The Match pattern module enables you to find and extract string elements matching a search pattern from a given text. The search pattern is a regular expression (aka regex or regexp), which is a sequence of characters in which each character is either a metacharacter, having a special meaning, or a regular character that has a literal meaning.

Hope this helps!

samliewrequest private consultation

Join the unofficial Make Discord server to chat with other makers!

2 Likes

Module Export

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

  1. Copy the JSON 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 (paste keyboard shortcut for Windows) to paste directly in the canvas.

  3. Click on each imported module and save it for validation. You may be prompted to remap some variables and connections.

View Module Export Code

JSON

{
    "subflows": [
        {
            "flow": [
                {
                    "id": 22,
                    "module": "json:TransformToJSON",
                    "version": 1,
                    "parameters": {
                        "space": ""
                    },
                    "mapper": {
                        "object": "{{21.data.conversations}}"
                    },
                    "metadata": {
                        "designer": {
                            "x": -485,
                            "y": -1267
                        },
                        "restore": {
                            "parameters": {
                                "space": {
                                    "label": "Empty"
                                }
                            }
                        },
                        "parameters": [
                            {
                                "name": "space",
                                "type": "select",
                                "label": "Indentation",
                                "validate": {
                                    "enum": [
                                        "tab",
                                        "2",
                                        "4"
                                    ]
                                }
                            }
                        ],
                        "expect": [
                            {
                                "name": "object",
                                "type": "any",
                                "label": "Object"
                            }
                        ]
                    }
                },
                {
                    "id": 23,
                    "module": "regexp:Parser",
                    "version": 1,
                    "parameters": {
                        "pattern": "\"id\":(?<tag_id>\\d+),\"lighten_color\"",
                        "global": true,
                        "sensitive": true,
                        "multiline": false,
                        "singleline": false,
                        "continueWhenNoRes": false,
                        "ignoreInfiniteLoopsWhenGlobal": false
                    },
                    "mapper": {
                        "text": "{{22.json}}"
                    },
                    "metadata": {
                        "designer": {
                            "x": -241,
                            "y": -1264
                        },
                        "restore": {},
                        "parameters": [
                            {
                                "name": "pattern",
                                "type": "text",
                                "label": "Pattern",
                                "required": true
                            },
                            {
                                "name": "global",
                                "type": "boolean",
                                "label": "Global match",
                                "required": true
                            },
                            {
                                "name": "sensitive",
                                "type": "boolean",
                                "label": "Case sensitive",
                                "required": true
                            },
                            {
                                "name": "multiline",
                                "type": "boolean",
                                "label": "Multiline",
                                "required": true
                            },
                            {
                                "name": "singleline",
                                "type": "boolean",
                                "label": "Singleline",
                                "required": true
                            },
                            {
                                "name": "continueWhenNoRes",
                                "type": "boolean",
                                "label": "Continue the execution of the route even if the module finds no matches",
                                "required": true
                            },
                            {
                                "name": "ignoreInfiniteLoopsWhenGlobal",
                                "type": "boolean",
                                "label": "Ignore errors when there is an infinite search loop",
                                "required": true
                            }
                        ],
                        "expect": [
                            {
                                "name": "text",
                                "type": "text",
                                "label": "Text"
                            }
                        ],
                        "interface": [
                            {
                                "type": "text",
                                "name": "tag_id",
                                "label": "tag_id"
                            },
                            {
                                "type": "uinteger",
                                "name": "i",
                                "label": "i"
                            },
                            {
                                "type": "any",
                                "name": "__IMTMATCH__",
                                "label": "Fallback Match"
                            }
                        ]
                    }
                },
                {
                    "id": 26,
                    "module": "util:FunctionAggregator2",
                    "version": 1,
                    "parameters": {
                        "fn": "count",
                        "feeder": 23
                    },
                    "mapper": {
                        "value": "{{23.tag_id}}"
                    },
                    "metadata": {
                        "designer": {
                            "x": 5,
                            "y": -1264
                        },
                        "restore": {
                            "parameters": {
                                "fn": {
                                    "label": "COUNT"
                                }
                            },
                            "extra": {
                                "feeder": {
                                    "label": "Text parser - Match pattern [23]"
                                }
                            }
                        },
                        "parameters": [
                            {
                                "name": "fn",
                                "type": "select",
                                "label": "Aggregate function",
                                "required": true,
                                "validate": {
                                    "enum": [
                                        "avg",
                                        "sum",
                                        "count",
                                        "max",
                                        "min"
                                    ]
                                }
                            }
                        ],
                        "expect": [
                            {
                                "name": "value",
                                "type": "number",
                                "label": "Value"
                            }
                        ],
                        "advanced": true
                    },
                    "flags": {
                        "groupBy": "{{23.tag_id}}"
                    }
                },
                {
                    "id": 27,
                    "module": "builtin:BasicAggregator",
                    "version": 1,
                    "parameters": {
                        "feeder": 26
                    },
                    "mapper": {
                        "__IMTKEY__": "{{26.`__IMTKEY__`}}",
                        "result": "{{26.result}}"
                    },
                    "metadata": {
                        "designer": {
                            "x": 253,
                            "y": -1264
                        },
                        "restore": {
                            "extra": {
                                "feeder": {
                                    "label": "Tools - Numeric aggregator [26]"
                                },
                                "target": {
                                    "label": "Custom"
                                }
                            }
                        }
                    }
                },
                {
                    "id": 28,
                    "module": "util:SetVariable2",
                    "version": 1,
                    "parameters": {},
                    "mapper": {
                        "name": "tag_counts",
                        "scope": "roundtrip",
                        "value": "{{toCollection(27.array; \"__IMTKEY__\"; \"result\")}}"
                    },
                    "metadata": {
                        "designer": {
                            "x": 500,
                            "y": -1265
                        },
                        "restore": {
                            "expect": {
                                "scope": {
                                    "label": "One cycle"
                                }
                            }
                        },
                        "expect": [
                            {
                                "name": "name",
                                "type": "text",
                                "label": "Variable name",
                                "required": true
                            },
                            {
                                "name": "scope",
                                "type": "select",
                                "label": "Variable lifetime",
                                "required": true,
                                "validate": {
                                    "enum": [
                                        "roundtrip",
                                        "execution"
                                    ]
                                }
                            },
                            {
                                "name": "value",
                                "type": "any",
                                "label": "Variable value"
                            }
                        ],
                        "interface": [
                            {
                                "name": "tag_counts",
                                "label": "tag_counts",
                                "type": "any"
                            }
                        ]
                    }
                }
            ]
        }
    ],
    "metadata": {
        "version": 1
    }
}

Thank you for your helping! It worked! Thank you so much!

2 Likes