IF statement...dynamic variable?

I'm trying to figure out a way to have the following

if variableA = true, then variableB = green, else variableB = red

(for setting background color of another script object)

Is there some way of doing this?

Yes, it should be possible. You'll need two variables: a boolean one, and a string dynamic variable (for the background color).

Ex:
{{BooleanVar}}
{{BackgroundColor}}

For the value of BackgroundColor, set it to:

 ifElse(equal({{BooleanVar}}, true), "#00ff00", "#ff0000")

Then set the script component's background to the BackgroundColor variable.

Here's a reference for the hex color codes if you're not familiar with it: https://htmlcolorcodes.com/

Thanks, that looks like it will do what I"m after. Can I ask what are the language/syntax options within those dynamic variables? Other than ifElse and concatenating strings, what else is there that's available?

I had tried to find some type of reference document but couldn't.

Here are some resource center articles about dynamic variables:




https://mathjs.org/docs/reference/functions.html

1 Like

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