Dynamic binding to a list

I’d like to create a binding, when a component’s property depends on the list of other component, whose reference numbers are given in the form of a string (or a dataset). I could compile the expression string from the list of numbers in a script by runScript(). But, is there a way to evaluate that string later into a binding expression, using something similar to the tag() function, but with more than one tag?

eval(runScript(“project.compExpr”, 0, {Component.dependList} )) // Tag1/BoolValue || … || TagN/BoolValue

The reason I’d like to evaluate the string instead of simply computing the value in the script is that the listed components’ properties are also bindable, so the string I compile needs to be reevaluated every time when they change.

Alternatively, can I “create” a binding in the script?

1 Like

Hi! I’m looking for a way to create a binding in a script. Did you solve this problem?

You can dig around in the JavaDocs, probably starting here. Then looking at the InteractionController on each window. (Bindings are part of the window, not the component.)

I’ve just posted a solution for the Designer context, that can be used, for example, for batch processing of multiple components, when templates are inapplicable:

do you think it is possible in Perspective?

I have not spent enough time under the hood of perspective yet… All of the above is Vision-specific.

To create a binding in Perspective, you just need to modify the view.json file on disk on the gateway with (valid) JSON structure.