Changing the value of a variable from another component?

Hello there,

I’m new here.
I have a very basic question:
is it possible to change the value of a variable defined in a component from another component?

I konw I can read it with componentName.script.variableName …
but can I change its value from somewhere else?

thank you!

Ok, I found that the answer is no …
and I figured that the best workaround is to just let the component read the values it needs …

The answer may still be yes, depending on how the other is defined. You can conditionally define things. Can you share your activity to take a look?

The activity is quite complex … but basically I have many screens that use the same graph. The graph has many options and I would like to have a component that controls the values for some of those options.
What do you mean when you say “conditionally defined”? something like v = 5 { condition } …

In CL you can use “when condition result when condition result… otherwise result” to define pretty much anything. As long as there isn’t circular logic, it should work fine. It will stop at the first valid condition and return the result, so you do have to be careful sometimes.

value = 12
myVariable = 
    when value >= 0 "It's positive."
    when x > 10 "It's larger than 10."
    otherwise "It's negative."

The above for example will never return the second message.

Ok, thanks for the answer.
I finally decided to have a component called “Settings” where all the graph components can read all the settings they need.

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