I created the blueprint below to try and find the maximum value in an array of numbers, but I can’t figure out how to update a variable’s value.
Specifically, in the 2nd iteration, the value of max is -1 instead of 3.
How can I do so?
Thanks.
{
"name": "test2",
"flow": [
{
"id": 6,
"module": "util:SetVariable2",
"version": 1,
"parameters": {},
"mapper": {
"name": "max",
"scope": "execution",
"value": "-1"
},
"metadata": {
"designer": {
"x": 296,
"y": 15
},
"restore": {
"expect": {
"scope": {
"label": "One execution"
}
}
},
"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": "max",
"type": "any",
"label": "max"
}
],
"advanced": true
}
},
{
"id": 7,
"module": "builtin:BasicFeeder",
"version": 1,
"parameters": {},
"mapper": {
"array": [
"3",
"2"
]
},
"metadata": {
"designer": {
"x": 687,
"y": 11
},
"restore": {
"expect": {
"array": {
"mode": "chose",
"items": [
null,
null
]
}
}
},
"expect": [
{
"mode": "edit",
"name": "array",
"spec": [],
"type": "array",
"label": "Array"
}
]
}
},
{
"id": 8,
"module": "util:SetVariable2",
"version": 1,
"parameters": {},
"mapper": {
"name": "max",
"scope": "execution",
"value": "{{if(6.max <= 7.value; 7.value; 6.max)}}"
},
"metadata": {
"designer": {
"x": 1056,
"y": 19
},
"restore": {
"expect": {
"scope": {
"label": "One execution"
}
}
},
"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": "max",
"type": "any",
"label": "max"
}
],
"advanced": true
}
},
{
"id": 9,
"module": "builtin:BasicAggregator",
"version": 1,
"parameters": {
"feeder": 7
},
"mapper": {},
"metadata": {
"designer": {
"x": 1428,
"y": 16
},
"restore": {
"extra": {
"feeder": {
"label": "Iterator [7]"
},
"target": {
"label": "Custom"
}
}
}
}
},
{
"id": 10,
"module": "util:GetVariable2",
"version": 1,
"parameters": {},
"mapper": {
"name": "max"
},
"metadata": {
"designer": {
"x": 1871,
"y": 13
},
"restore": {},
"expect": [
{
"name": "name",
"type": "text",
"label": "Variable name",
"required": true
}
],
"interface": [
{
"name": "max",
"type": "any",
"label": "max"
}
]
}
}
],
"metadata": {
"instant": false,
"version": 1,
"scenario": {
"roundtrips": 1,
"maxErrors": 3,
"autoCommit": true,
"autoCommitTriggerLast": true,
"sequential": false,
"slots": null,
"confidential": false,
"dataloss": false,
"dlq": false,
"freshVariables": false
},
"designer": {
"orphans": []
},
"zone": "eu2.make.com"
}
}