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":
"test@yahoo.fr",
"attributesName":
"",
"attributesValue":
""
},
{
"email":
"test@hotmail.com",
"attributesName":
"present",
"attributesValue":
"yes"
},
{
"email":
"test@orange.fr",
"attributesName":
"",
"attributesValue":
""
},
{
"email":
"test@neuf.fr",
"attributesName":
"",
"attributesValue":
""
},
{
"email":
"e.test@ladomitienne.com",
"attributesName":
"",
"attributesValue":
""
},
{
"email":
"test.vaysse@gmail.com",
"attributesName":
"oka",
"attributesValue":
"try"
},
{
"email":
"test.gregoire.2007@gmail.com",
"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

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