Hello,
how do i access the values contained in the properties set by the SET node inside an expression, without specifying the set node name?
In the example below, I set the “string” property to “value1” if the switch is set to 0, and to “value2” if the switch is set to 1.
In the execute command node, and in the read binary node, I would like to be able to access this value.
Below is the code of the example in question:
{
"nodes": [
{
"parameters": {},
"name": "Start",
"type": "n8n-nodes-base.start",
"typeVersion": 1,
"position": [
260,
330
]
},
{
"parameters": {
"dataType": "boolean",
"value1": "={{$json[\"property\"]}}",
"rules": {
"rules": [
{
"value2": true
},
{
"output": 1
}
]
}
},
"name": "Switch",
"type": "n8n-nodes-base.switch",
"typeVersion": 1,
"position": [
760,
330
]
},
{
"parameters": {
"values": {
"boolean": [
{
"name": "property",
"value": true
}
]
},
"options": {}
},
"name": "Set",
"type": "n8n-nodes-base.set",
"typeVersion": 1,
"position": [
540,
330
]
},
{
"parameters": {
"values": {
"string": [
{
"name": "string",
"value": "value1"
}
]
},
"options": {}
},
"name": "Set1",
"type": "n8n-nodes-base.set",
"typeVersion": 1,
"position": [
1020,
210
]
},
{
"parameters": {
"values": {
"string": [
{
"name": "string",
"value": "value2"
}
]
},
"options": {}
},
"name": "Set2",
"type": "n8n-nodes-base.set",
"typeVersion": 1,
"position": [
1020,
450
]
},
{
"parameters": {
"command": "="
},
"name": "Execute Command",
"type": "n8n-nodes-base.executeCommand",
"typeVersion": 1,
"position": [
1270,
330
]
},
{
"parameters": {
"command": "=cd string"
},
"name": "Execute Command1",
"type": "n8n-nodes-base.executeCommand",
"typeVersion": 1,
"position": [
1470,
330
]
},
{
"parameters": {
"filePath": "string"
},
"name": "Read Binary File",
"type": "n8n-nodes-base.readBinaryFile",
"typeVersion": 1,
"position": [
1680,
330
]
}
],
"connections": {
"Start": {
"main": [
[
{
"node": "Set",
"type": "main",
"index": 0
}
]
]
},
"Switch": {
"main": [
[
{
"node": "Set1",
"type": "main",
"index": 0
}
],
[
{
"node": "Set2",
"type": "main",
"index": 0
}
]
]
},
"Set": {
"main": [
[
{
"node": "Switch",
"type": "main",
"index": 0
}
]
]
},
"Set1": {
"main": [
[
{
"node": "Execute Command",
"type": "main",
"index": 0
}
]
]
},
"Set2": {
"main": [
[
{
"node": "Execute Command",
"type": "main",
"index": 0
}
]
]
},
"Execute Command": {
"main": [
[
{
"node": "Execute Command1",
"type": "main",
"index": 0
}
]
]
},
"Execute Command1": {
"main": [
[
{
"node": "Read Binary File",
"type": "main",
"index": 0
}
]
]
}
}
}
Thanks so much
