1. Simple query syntax

    Article: AN0001884Updated:
    1. The class can be stated in the query in a short reference (if the class belongs to the same model like query) or in a full reference (it is necessary when the class belongs to another model). The reference has to be contained in double brackets with a colon.
      1. Short reference: {{:class.domains:}}
      2. Full reference: {{:model.it-configurations.class.domains:}}
    2. It is possible to use parameters defined in the application and refer to them in a way depending on them being defined in a particular model or in the whole ObjectGears instance:
      1. {{ model_code.par. parameter_code}}
      2. {{app.par. parameter_code}}

    Replace model_code by the code of model in which the parameter is defined (if it is not defined on the ObjectGears instance level), replace parameter_code  by code of parameter.

    1. In a classic SQL query we can set a name for record set, which we work later on with, to facilitate referencing to this record set. In ObjectGears it is necessary always to set a name to classes, we refer to. The name of the class within the query has to be placed behind the reference to the class.
    2. Names of classes or columns that are reserved keywords of MS SQL Server have to be stated in square brackets – e.g.: [order], [name].

    Example:

    select * from {{:model.cobit.class.domains:}} domains where [order]  > {{app.par.parnumber2}}

    Class that we refer to as {{:model.cobit.class.domains:}} has to have a name – we choose the name domains.

    In the condition „where” we want to refer to the column of the class domains, that is called order. Since order is a reserved keyword of SQL standard, it is necessary to state it in square brackets.

×