# Init Global array and flush it

**URL:** <https://discourse.nodered.org/t/init-global-array-and-flush-it/59078>\
**Category:** General\
**Created:** [27 February 2022 19:37 UTC](https://discourse.nodered.org/t/init-global-array-and-flush-it/59078 "2022-02-27T19:37:45Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![thierry-rhone](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/thierry-rhone/32/39551_2.png) [@thierry-rhone](https://discourse.nodered.org/u/thierry-rhone)\
**Post date:** [27 February 2022 19:37 UTC](https://discourse.nodered.org/t/init-global-array-and-flush-it/59078/1 "2022-02-27T19:37:45Z")

</div>

Hi,  
I'm searching how create a global empty array with name 'sources'  
afterward I will fill it to have a array such as this one

```auto
sources
0 : "Name": "thierry"
    "Num": 3
1 : "Name": "search"
    "Num": 1
2 : "Name": "solution"
    "Num": 7
...

```

my problems

- create empty array
- to be able to empty it to obtain 0 elements

Thanks for your help

---

<div class="post-metadata">

**Author:** ![mickym2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/mickym2/32/36128_2.png) [@mickym2](https://discourse.nodered.org/u/mickym2)\
**Post date:** [27 February 2022 20:16 UTC](https://discourse.nodered.org/t/init-global-array-and-flush-it/59078/2 "2022-02-27T20:16:11Z")

</div>

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/5/7/57de4fdfe1a42af22b9c0fd41d80deef266db014.png)

```auto
[
    {
        "id": "84a107a6183c6531",
        "type": "inject",
        "z": "7b9f1dda6e01a77d",
        "name": "",
        "props": [
            {
                "p": "payload"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "[]",
        "payloadType": "json",
        "x": 830,
        "y": 1580,
        "wires": [
            [
                "f8ed539f67f09dc7"
            ]
        ]
    },
    {
        "id": "f8ed539f67f09dc7",
        "type": "change",
        "z": "7b9f1dda6e01a77d",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "sources",
                "pt": "global",
                "to": "payload",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 1040,
        "y": 1580,
        "wires": [
            []
        ]
    }
]

```

---

<div class="post-metadata">

**Author:** ![thierry-rhone](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/thierry-rhone/32/39551_2.png) [@thierry-rhone](https://discourse.nodered.org/u/thierry-rhone)\
**Post date:** [27 February 2022 21:15 UTC](https://discourse.nodered.org/t/init-global-array-and-flush-it/59078/3 "2022-02-27T21:15:07Z")

</div>

Perfect !  
Thanks Mickym2

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [28 April 2022 21:15 UTC](https://discourse.nodered.org/t/init-global-array-and-flush-it/59078/4 "2022-04-28T21:15:36Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
