Query and VisualQuery
2sxc Templates and Headless APIs can use Queries to access data. This is pretty amazing:
- You create such queries using a VisualQuery designer
- Queries can then be assigned to a View so the template recieves this as the data to work with
- Queries can also be used directly in the Headless API if you configure the permissions for this
- The Edit-UI can also use queries in dropdown fields
- You can also access queries using App.Query["QueryName"]
In addition, there are also some built-in System Queries built-in which will get system data for you like a list of Content-Types or Apps in the System.
Tip
Note that Queries can created in code and using VisualQuery. The code method is very advanced. You can read more about using DataSources in C# / Razor code. The rest of this page is about VisualQuery.
Queries in an App
All Queries (except for the System-Queries) are stored in the App - this is what it looks like:
Create Queries
To create a new Query hit the + and continue from there:
Edit Queries
Use the VisualQuery Designer
Export / Import
Technical Implementation
When queries run they behave like Data-Sources while internally chaining various other Data-Sources to query the underlying data.
History
- introduced in 2sxc 6
- continuously enhanced