Maybe this helps?
[
{
"id": "e5924cbdf8979d8c",
"type": "inject",
"z": "f6c346cb44030a48",
"name": "Change value 1 to 1",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "1",
"payload": "1",
"payloadType": "str",
"x": 4250,
"y": 1540,
"wires": [
[
"0b1582a0c148955c"
]
]
},
{
"id": "32ab4c4489e5739e",
"type": "inject",
"z": "f6c346cb44030a48",
"name": "change value 1 to 2",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "1",
"payload": "2",
"payloadType": "str",
"x": 4250,
"y": 1600,
"wires": [
[
"0b1582a0c148955c"
]
]
},
{
"id": "0b1582a0c148955c",
"type": "function",
"z": "f6c346cb44030a48",
"name": "",
"func": "if(msg.topic == 1){\nglobal.set(\"aTestVar[\"+0+\"].value1\",msg.payload)\n}\nif(msg.topic == 2){\nglobal.set(\"aTestVar[\"+0+\"].value2\",msg.payload) \n}\n\nreturn msg;\n",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 4560,
"y": 1620,
"wires": [
[]
]
},
{
"id": "e4f3e83ec7996167",
"type": "inject",
"z": "f6c346cb44030a48",
"name": "Change value 2 to 1",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "2",
"payload": "1",
"payloadType": "str",
"x": 4250,
"y": 1660,
"wires": [
[
"0b1582a0c148955c"
]
]
},
{
"id": "216df17272664a45",
"type": "inject",
"z": "f6c346cb44030a48",
"name": "change value 2 to 2",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "2",
"payload": "2",
"payloadType": "str",
"x": 4250,
"y": 1720,
"wires": [
[
"0b1582a0c148955c"
]
]
}
]