What is a Data Provider’s scope?
Scope refers to the context of a Data Provider element, which determines the accessibility of the data it provides to other elements of the Graphics Package. There are two types of scope:
A global Data Provider’s data will be accessible from anywhere in the Graphics Package, no matter if the elements binding to it aren’t nested within it, or if they are placed in a different Overlay or Scene. It is globally accessible. Data Providers with global scopes are indicated with a green globe icon next to their names in the Elements Tree. We suggest you group all global Data Providers in a single Overlay for better organization.
A local Data Providers’ data will be only accessible for the elements that are nested within that Data Provider in the Elements Tree. Those are elements in the Provider’s local scope.
How Local and Global scopes work
Scopes have an impact on the way you edit (Graphics Editor) and operate (Remote Control) your Graphics Package.
In the Graphics Editor, the main difference is in the data binding workflow.
When using local Data Providers, only their descendant elements (1) will display the data binding options —such as data source binding (2), dynamic backgrounds (3), or conditional visibility options (4)— on the Inspector Panel. As mentioned before, that’s what the local scope is about.
But when there is at least one global Data Provider present, the data binding options will appear on every element across the Graphics Package, they do not need to be parents, and all of them will be able to bind to it.
To create a Global Provider you can double-click on a Data Provider element in the Data Providers panel.
Also, you can select a Local Data Provider and change it to Global scope over the Inspector.
If you have a Graphics Package already using Global Providers, and they are scattered among every other element on the Tree, you will see a button to move them all with a single click.
On the Remote Control, the difference relies on where the operator will find each Data Provider's controls, like pagination buttons for Collection Providers or parameters for Data Connector Providers.
A locally-scoped Data Provider's controls will be shown only when the Overlay that contains it is selected.
A globally-scoped Data Provider’s controls, on the other hand, will be shown on a panel that summarizes them all in a single selectable element, that will let you see all their controls at once.
Keep in mind that any updates on a global Data Provider —such as changing a Collection, or syncing a Data Connector— will always affect every element bound to it, no matter the Overlay that is selected at the moment.
What is global scope useful for?
Global Data Providers are especially useful when you have a lot of Graphic elements scattered among different Overlays or Scenes, using the same data source, and need to be in sync both for quick operation and easy reusability.
For example, in a soccer match in Graphics, where you have an Overlay showing the team's logos and names, another Overlay showing each team’s formations, and another one showing the scorebug.
With a single global Data Connector Provider, you will be able to control all the information shown, doing a single sync each time that is needed, or changing the teams only once when the next match is coming.
They also improve the Graphics Package performance, as the data requests and transformations are handled only once.
How to turn a local Data Provider into a global one
Changing a Provider’s scope is very easy.
- Select the (local) Data Provider
- Look for the “Data Provider scope” section on the Inspector Panel
- Click the “Make global” button
How to unify similar Local Providers into a single Global Provider
If you already have several local Data Providers created across the Graphics Package, and they all use the same data source (a Collection, Mechanic, Data Connector, etc), you can easily optimize this with a couple of clicks.
This process starts by manually setting one of them to global scope. Then you will use a wizard tool to rebind every element bound to each of those old local Providers to this new global one. The tool will also replace all those —now unused— local Providers for Containers, in order to keep visual consistency (sizes, positions, backgrounds, borders).
- Select a local Data Provider
- Click the “Make Global” button to change its scope
- Click the Gearwheel icon menu that appeared and select the “Find and replace similar Local Providers” option
- Select the local Data Providers you would like to replace.
- Only the compatible Local Data Providers are listed. This means that if you are triggering this find and replace action from a Data Connector Provider, only other Data Connector Providers will be listed, and not Collection Providers or Mechanic Providers, for example.
- The ones marked with a “matching” label are those which have exactly the same parameters as the global one.
- Those with the “alike” label are slightly different, but compatible for replacement. In the case of Data Connectors, for example, this means they might be using the same Connector and same Dataset, but have a couple of different parameters set.
- Click the “Replace” button