1. Queries

    Article: AN0001638Updated: 31.07.2018

    Queries are used for displaying data from classes, that are adapted in some way (e.g. displaying summary data about orders per month, numbers of tasks assigned to particular teams etc.). Data do not have to be displayed directly in the way how they are stored in the class, but some operation may be performed with them (grouping etc.).

    You can create whatever number of queries you want. By assigning roles to queries you can display various queries to various users.

    Data from queries can be read only. Saving data from queries is not possible.

    Query data source

    Query is constructed as SQL command directly into the database (with small differences). You can use classes of ObjectGears system or whatever table or view in the database as a data source. If you use linked servers, you can use also tables and views from the linked server in case you use correct SQL syntax.

    In case of more sofisticated queries you can read data directly from a stored procedure in the database.

    Properties common with a class

    There are few differences between class and query. Query cannot be updated and does not have its owen data (reads them from another class). However, query has a range of properties common with a class. E.g. sorting and paging, pictures, RSS, access via roles etc. Description of these properties can be found at class documentation.

    Query columns

    After checking query syntax ObjectGears system executes the query and based on returned values creates columns. The database can only provide information about column type without saying from which class it comes from. Therefore, it is sometimes necessary to go through created columns and adjust their type after new view creation. E.g. if the column is an integer, than it can be integer column or colour.

    Reference to another class or to user

    When defining a query you can use a special notation by means of which column of type Value from a refrenced class is created. This type of column links data between query and class and enables to navigate from the displayed query data to the detail display of a class record.