Need to apply IF condition

Describe the problem/error/question

I want to apply a If condition like
If set of data is invalid expression, it will give null else it will show the value.

{{ $if(('IF1').item.json["dataValue"] == Invalid expression), null, ('IF1').item.json["dataValue"] }}

But this give me null everytime.

2nd Question, I want to pass this value to subworkflow.

{{ $if($('S') != null, $('S')"=").pop(), $('S').item.json.klaviyoData) }}

But not consuming

What is the error message (if any)?

Please share your workflow

Share the output returned by the last node

Information on your n8n setup

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

Hi @Gouravdev,
you can try to use the conditional ternary operator like:
{{ $('Code') ? $('Code') : 'default' }}

To pass this value to subworkflow you don’t need any special syntax, you just need to plug the Execute Workflow node and this will pass all the incoming data items to the sub workflow.

Check this demo workflow:

Let me know if this helps or you need more support
All the best

1 Like

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