Table of Contents

Instance Data (vs. All App Data)

you are here (click to zoom) - discover the stack

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:

  1. An editor added content manually, so this is the data that should be worked with
  2. A Query prepared data for this Module Instance

Instance Data is data which is pre-selected for one Module Instance. Either because it was edited this way or because the View Configuration specified a Query.

Common Scenarios for Instance Data

  1. Content with text, images etc. which should appear on a Module
  2. Lists of Content items which are added/edited individually
  3. Views which need a bit of configuration information specific to that instance
  4. 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


History

  1. Introduced in 2sxc v1
  2. App.Data added ca. 2sxc 6
  3. App.Query added ca. 2sxc 7