Describe the problem/error/question
I’m very early on on my javascript learning curve but look forward to the day I can help others as I do with other things I am technically proficent with.
Minimal, Reproducible Example:
Desired behaviour:
I am trying to use multiple .replace and currently have it working in a ‘Set’ node like:
{{$json["data"].replace('data1','output1').replace('data2','output2')}}
Specific problem or error:
What I can’t seem to get to work is when the .replace data I want to use is coming from a variable (as was generated earlier in the flow) instead of being typed manually.
Shortest code necessary to reproduce the problem:
Examples of some code that I have tried using different characters in-between like + and &, etc:
{{$json["data"]+$node["replaceList"].json["variable"]}}
and
{{$json["data"]++$node["replaceList"].json["variable"]}}
and
{{$json["data"]&$node["replaceList"].json["variable"]}}
and
{{$json["data"]&&$node["replaceList"].json["variable"]}}
and
{{$json["data"].$node["replaceList"].json["variable"]}}
and
{{$json["data"]$node["replaceList"].json["variable"]}}
etc.
(Where “variable” is: .replace('data1','output1').replace('data2','output2')
I would be deeply appreciative if anyone can spare a few seconds to suggest how my code should be formatted for it to work as all I get is [undifined].
What is the error message (if any)?
Usually just [undifined]
Please share your workflow
Although no idea if it’ll help, below is the code from that entire node:
(Select the nodes on your canvas and use the keyboard shortcuts CMD+C/CTRL+C and CMD+V/CTRL+V to copy and paste the workflow.)
Share the output returned by the last node
n/a
Information on your n8n setup
- n8n version: latest
- Database (default: SQLite): ?
- n8n EXECUTIONS_PROCESS setting (default: own, main): ?
- Running n8n via (Docker, npm, n8n cloud, desktop app): desktop, online
- Operating system: windows, linux