Every time you want to reference a global variable in code you have to first bind it to an input. Why? Please end this.
Can you be more specific? Global Variable for what?
@josecgomez in order to use the value of a global variable in the product configurator* you have to first associate the global variable to an input. Then you can reference the input value… at least that is what we have experienced.
Is that not true? You would make my day for the second time if you told me we could reference them without assigning them to an input.
I think there are Global Input Variables AND Local Variables. The former needs to be bound to an input but the latter should be available from the Expression Tree. The Local variables are available to the whole configurator but the Global Input Variables can be passed to sub-configurators if I recall correctly.
Exactly, I need to use Global variables in sub configurators but in order to do that I have to waste time and add as many inputs in each subconfigurator as the number of global variable required in the sub configurator. Why?
Sorry for the vagueness.
Ah, OK. I think it’s because Global Inputs are bi-directional. If you change it in a sub, it will pass to all others. If it wasn’t bound, you’d run the risk of not passing it back. That’s my guess of the design decision to bind.
Having a Global Variable that’s not bound might be interesting but I wonder about possible side effects.
What I’d REALLY like to see are UD Methods that are global across configurators. DRY = Don’t Repeat Yourself!
That is fine if it is bi-directional, but I still don’t see why having an input decreases the risk of it not being passed back. You should be able to at least reference them without an input. I agree with you about the global UD methods across all configurators.
Let’s say I pass the value to a field. That field is changed by a calculation in the sub-configurator. If not bound, how would the other configurators know the global value had changed unless you remembered to assign it back to the global var? I can see lots of support calls…
I still like the idea of an unbound global variable though…