Version:
  1. Reference to a class or user

    Article: AN0001639 Updated: 04.06.2019 Displayed: 653x

    When using a special notation you can create a column of type Value from a referenced class. This column enables to link query data to a class record.

    ObjectGears system cannot found out where are query data from. Therefore, you have to determine it by means of column name. Correctness of the link (correct class and mapping ID) is responsibility of the query creator.

    Format of the column name for columns of type reference to a single record

    The required information has to be input in the alias after the key word AS. Te first part of the alias defines code and name of the column that the query will return, then there are three signs of underscore and after them the code of the target class or the keyword person.

     

    Example of the link of the column mybuilding to the class building:

    mybuilding___building

    Example of the link of the column teamleader to user:

    teamleader___person

    In both cases both cases query columns have to contain ID from the class or user ID.

    A complete example:

    SELECT my.building AS mybuilding___building, my.teamleader AS teamleader___person
    FROM {{: class.myclass :}} my

    Reference to a class from another model

    In case that the referred class belongs to another model you have state in the column name also model code. Put the model code infront of the class code and separate them with colon. The whole name must be then put in braces.

    We will use the previous example with one difference: class building will be defined in model myModel.

    SELECT my.building AS [mybuilding___mymodel:building], my.teamleader AS teamleader___person
    FROM {{: class.myclass :}} my

    Format of the column name for columns of type reference to more records

    The query syntax for reference to column of type reference to more records differs from the previous examples and is following:

    record_identifiers required_query_column_name___class_code___column_code

    ap.id approvers___approval_process___approvers

    The whole query example:

    SELECT ap.id,
    ap.name,
    ap.id approvers___approval_process___approvers,
    ap.id company___approval_process___applicable_for,
    ap.id process___approval_process___cl_approval_process
    FROM {{:class.approval_process:}} ap

     

    Examples of creating queries with references are shown in Examples and recommended techniques.

  2.    ---
    Your rating:
    Rated by users: 0x
  3. Top
SearchTitle
×