Subflow variables

I'm using subflow in my node-red with one env-variable.

if i use the variable individually, then it works:
image
image

But when I use them inside another String, it doenst work anymore. is there a workaround or a solution for it?

image
image

You can set the to value to JSONata and use

"STRING" & $env("ENVIRA_VARIABLE_NAME") & "STRING"

If you change the type of the field to 'env variable' then you should be able to do what you want:

ok nice to know.

but I was using change node just for testing, now with the firebase node, I cant use env as type of field:

image

Only env fields support having an env var in the middle.

All other field types can only replace the whole value with an env var, not just a part of it.

One work around is to add another subflow variable using the env type that sets that variable to the value you want (with the first env var embedded in the middle).

You can then use that new env var in the firebase node to replace the whole field.

yes that what I was thinking about. I found in the docu that it is possible to set the field with msg.firestore:

Firestore Write

Node performs write operations to the referenced collection, subCollection or document.

Configurations made from within the node or on the msg.firestore property:

  • operation : [string] Write operation to perform, either add , set , update or delete
  • collection : [string] collection or subCollection reference to write to.
  • document : [string] document reference to write to (optional for add operations)
  • options : [object] additional options passed to firebase (currently specific to set operations)

how to combine this msg.firestore with msg.payload??

Not quite sure what you mean. You can use a Change node to set msg.firestore to whatever you want it to be - including from an env value.

I have payload with the values:
image

and this I have to put into the collection wich I have to set with msg.firestore. Thats why I'm asking how to combine this payload with msg.firestore

Sorry - I have not used the firestore node, so cannot help.

As this topic is about subflow variables, you may want to start a new topic with a title related to firestore so users more familiar with it will see it.

1 Like

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