Hey!
How do I convert a specific string value to true / false and apply to a Boolean object in a set node?
mcnaveen, thanks for the answer!
This is not what I want (.
I’ll try to explain in words.
- I have a webhook with a payload that contains multiple strings with a “Y” or “N” value.
- Next, I have a set node, in which I want to convert this value to true or false, respectively, but changing the type of the object (if I correctly interpret the terminology, perhaps this is a misunderstanding of my task) from string to boolean.
- The expression I need to write inside the boolean field, which is located in the set node.
I tried for a few hours to figure out the javascript here: Conditional (ternary) operator - JavaScript | MDN
But nothing happened, unfortunately (.
Hey @Roket, since you are using the assignment operator =
instead of the comparison operator in JavaScript ===
, the is_need_corrector
variable always gets the value Y assigned and it will always return true. Since you want conversion to boolean values here, you don’t really need to use the conditional operator as the comparison operator returns boolean values. More details here.
Here’s an example workflow:
Hope that helps
2 Likes
That’s great to hear, have fun!
1 Like