To achieve this, your increment module Reset value field should be set to Never, and
You need to use the modulo (mod) operator to divide it by the number of routes you have.
Module Export
You can copy and paste this module export into your scenario. This will paste the modules shown in my screenshots above.
-
Copy the JSON code below by clicking the copy button when you mouseover the top-right of the code block

-
Enter your scenario editor. Press ESC to close any dialogs. Press CTRLV (paste keyboard shortcut for Windows) to paste directly in the canvas.
-
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": 1,
"module": "util:FunctionIncrement",
"version": 1,
"parameters": {
"reset": "scenario"
},
"mapper": {},
"metadata": {
"designer": {
"x": -254,
"y": 75
},
"restore": {
"parameters": {
"reset": {
"label": "Never"
}
}
},
"parameters": [
{
"name": "reset",
"type": "select",
"label": "Reset a value",
"required": true,
"validate": {
"enum": [
"run",
"execution",
"scenario"
]
}
}
]
}
},
{
"id": 2,
"module": "builtin:BasicRouter",
"version": 1,
"mapper": null,
"metadata": {
"designer": {
"x": -7,
"y": 74
}
},
"routes": [
{
"flow": [
{
"id": 3,
"module": "util:SetVariable2",
"version": 1,
"parameters": {},
"filter": {
"name": "first",
"conditions": [
[
{
"a": "{{1.i % 3}}",
"o": "number:equal",
"b": "1"
}
]
]
},
"mapper": {
"name": "num",
"scope": "roundtrip",
"value": "{{1.i}}"
},
"metadata": {
"designer": {
"x": 319,
"y": -119
},
"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": "num",
"label": "num",
"type": "any"
}
]
}
}
]
},
{
"flow": [
{
"id": 4,
"module": "util:SetVariable2",
"version": 1,
"parameters": {},
"filter": {
"name": "second",
"conditions": [
[
{
"a": "{{1.i % 3}}",
"o": "number:equal",
"b": "2"
}
]
]
},
"mapper": {
"name": "num",
"scope": "roundtrip",
"value": "{{1.i}}"
},
"metadata": {
"designer": {
"x": 442,
"y": 76
},
"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": "num",
"label": "num",
"type": "any"
}
]
}
}
]
},
{
"flow": [
{
"id": 5,
"module": "util:SetVariable2",
"version": 1,
"parameters": {},
"filter": {
"name": "third",
"conditions": [
[
{
"a": "{{1.i % 3}}",
"o": "number:equal",
"b": "0"
}
]
]
},
"mapper": {
"name": "num",
"scope": "roundtrip",
"value": "{{1.i}}"
},
"metadata": {
"designer": {
"x": 318,
"y": 244
},
"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": "num",
"label": "num",
"type": "any"
}
]
}
}
]
}
]
}
]
}
],
"metadata": {
"version": 1
}
}
samliew – request private consultation
Join the unofficial Make Discord server to chat with other makers!



