Expression inside another expression

I have a SplitInBatches that I get a result I would like to insert as a variable in another node’s expression for me to return the correct value in an IF node

in the attached photo is an example of item 1
{{$node[“Search for request”].json[“registration number”]}}

Returns the value I need, only what it will look for varies, and what it should be search with me through another node {{$node[“SplitInBatches1”].json[“node”][0]}}

In this case what you would need would be something like
{{$node[“Fetch order”].json["{{$node[“SplitInBatches1”].json[“node”][0]}}"]}}

I don’t know if it’s possible to do this, thanks for any help

Hey @Rodrigo_Barbosa,

Try dropping the extra {{ }}, you only need them to start an expression once opened you should be able to use the $variables as you please.

I don’t think you need the " " either.

1 Like

Hello @Jon , I am jumping into this topic cause I am having some trouble with my expression:

{"attributes":{"MIAL{{$runIndex}}":"{{$node["SplitInBatches"].json["matchingItems"][0]["N° de commande"]}}"},"updateEnabled": true,"email":"{{ $node["SplitInBatches"].json["Email_contact"] }}"}

And my goal is to replace the [0] index of …json[“matchingItems”][0]… with {{$runIndex}}.
If I add it the output return Syntax error.
Do you have any ideas?

Hey @Gabriele_Bracciali,

Have you tried using a Code node?

No, I should use it in a HTTP request like JSON Body

I take it the data you want to send based on your expression there would be…

  "attributes": {
  "updateEnabled": true,
  "email":"[email protected]"

As a quick test I have mocked up what I think the output looks like and sent the request to and it seems to work as expected, Are you seeing an error or are you expecting the data to be something else?


it’s not the case that i need, maybe I didn’t explain well the goal.

I would like to replace the [0] inside the expression json
Screenshot 2023-01-11 at 14.11.02

with the command {{$runIndex}}

basically i want the index of this incremental each run

Ah that would be different, I am not sure why you would want to that but something like this should do the job…

{"attributes":{"MIAL":"{{$node["SplitInBatches"].json["matchingItems"][$runIndex]["N° de commande"]}}"},"updateEnabled": true,"email":"{{ $node["SplitInBatches"].json["Email_contact"] }}"}

I need this for an automatic process, and I need to increase the “index” of the array, so I was thought to do like that.

@Jon Edit:
Seem like it working, I have to double check

1 Like