Best practices for window data flow?

A pretty general question here. The project I work on was made by many different authors and so many different styles of introducing data to a window. From what I’ve seen so far -

A ID parameter is passed to a window, which then runs a query in onWindowOpen/onWindowActivated for the rest of the data based on the ID, which then goes root container properties, to which components are bound.

An ID parameter is passed to a window, which runs a query for the rest of the data in onWindowOpen/onWindowActivated, which then in the same scripting window assigns the data to the components.

An ID parameter is passed directly to a root container custom property (no Window Scripting) and a separate root container custom property uses it to run the data query, and all components that need data now take it from the second root container custom property dataset.

I’m sure you may have seen other methods as well. Is there a agreed upon best way? What advantages does your way have over the others that I’ve mentioned?

I’m personally a fan of the third way, so that I can leave the window scripting clean(er), and also because if components are referencing a root container custom property for their data you can use an overlay-opt out.

I’m trying to convert the project I am working on to something more maintainable which is why I am asking.

There’s no generally agreed way, but I too would use your third method. I prefer query bindings over queries in event scripts, as the former don’t block the GUI thread. I put more complex data processing in asynchronous tasks, and deliver results to dataset properties (for atomicity). I extract from such datasets directly to properties on components or templates.

1 Like