Using Expression route in Switch node

Describe the issue/error/question

Hello everyone, I would like to use a Switch Node in Expression Mode (I’ven’t find so much resource online)
I would like to route my input with the following condition:

If attributesName and attributesValue are empty > output 1
If attributesName and attributesValue are NOT empty > output2

Please share the workflow

Input

[
{
"email":
"[email protected]",
"attributesName":
"",
"attributesValue":
""
},
{
"email":
"[email protected]",
"attributesName":
"present",
"attributesValue":
"yes"
},
{
"email":
"[email protected]",
"attributesName":
"",
"attributesValue":
""
},
{
"email":
"[email protected]",
"attributesName":
"",
"attributesValue":
""
},
{
"email":
"[email protected]",
"attributesName":
"",
"attributesValue":
""
},
{
"email":
"[email protected]",
"attributesName":
"oka",
"attributesValue":
"try"
},
{
"email":
"[email protected]",
"attributesName":
"",
"attributesValue":
""
},
]

Information on your n8n setup

  • n8n version: 0.213.0
  • Database you’re using (default: SQLite):
  • Running n8n with the execution process [own(default), main]:
  • Running n8n via [Docker, npm, n8n.cloud, desktop app]: n8n.cloud

Update:
I’ve write this expression that return in output: Output 1 or Output 2

{{$json["attributesName"] || $json["attributesValue"] ? "Output 1" : "Output 2"}}

But there is no output data in this branch

Solved using the Switch like Rules
And then adding the function above in the first value

2 Likes

Glad to see you’ve figured it out already, thanks for sharing your solution :slight_smile:

1 Like

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