Instance Data (vs. All App Data)
Apps can have a lot of data and the entirety of this data is called the App Data.
Usually every Instance (use) of a Template will only work with a selection of this data. You could write code to find the parts you need, but usually that work is automatically done by 2sxc. This is possible thanks to two common scenarios which determine what data should to be used:
- An editor added content manually, so this is the data that should be worked with
- A Query prepared data for this Module Instance
Common Scenarios for Instance Data
- Content with text, images etc. which should appear on a Module
- Lists of Content items which are added/edited individually
- Views which need a bit of configuration information specific to that instance
- Views which receive the data to work with from a Query (so the Query defines what Data should be used in this instance)
Difference Instance-Data and App Data
Instance Data is only a part of the App Data, while the App Data contains everything in the App.
In your code, Instance Data is prepared by the engine and available on objects like
Content if the editor added content or if a Query was specified.
On the other hand the complete App Data is available on objects like
App which are always available even if no Instance Data exists.
Read more about where data comes from in your code
- Introduced in 2sxc v1
- App.Data added ca. 2sxc 6
- App.Query added ca. 2sxc 7