JSL - HeyWith say a GPT user prompt, how can ...
Hey
With say a GPT user prompt, how can I insert a variable from a previous node if it's not null. So "emails: + emailNode else "n/a" if null?
Solution:Jump to solution
This only works for undefined variable or null values, not undefined node, undefined node will never gets executed, you can get the
type of
data but not a node, I would recommend to use Switch instead of Branch in this case where it will call only the case matched.6 Replies
thanks for any assistance
Hi @JSL, You can use ternary operator in this case -
email ? (x)email : "no email"
In my data the last name was empty, so ternary operator evaluates the field, if null then show added string. More about ternary operator - link.
Would that work for a undefined node, I have a couple of branches so the node with the data may not always be called. This is where I am running into the issue. I tried typeof {node} !== 'undefined' however it still responded with cannot read undefined node
Solution
This only works for undefined variable or null values, not undefined node, undefined node will never gets executed, you can get the
type of
data but not a node, I would recommend to use Switch instead of Branch in this case where it will call only the case matched.thanks Gaurav