Hello guys.
I am going to make a text with some input fields.
inputs : url01 - url02 - url03
my text file will be : your first url is {{url01}} and second is {{url02}} and third is {{url03}}.
if all inputs are available the out put is ok, but if second and third are not available the out put shows like this :
your first url is {{url01}} and second is [undefined] and third is [undefined].
how to set it to write the output length based on the input ?
if we have url01 : your first url is {{url01}}.
if we have url01 and url02 : your first url is {{url01}} and second is {{url02}}.
if we have all of them : your first url is {{url01}} and second is {{url02}} and third is {{url03}}.
i know i can use switch node, but my outputs are more than 4.
The quickest approach would be to use a code node to build out your message based on the inputs but you could also do something with a ternary operator in an expression if you wanted to. It may be a bit different if url03 is set and url02 isn’t so I would probably look at using the code node instead so you can count the urls and work out how many to display it will also allow you to scale a lot easier as well.
Here is a quick example using a ternary operator in an expression, If you run the workflow you can change between the 2 different results on Set1 by changing the run on the output view.