1. Example: Restricting data in selection controls

    Article: AN0002368Updated: 08.11.2018

    In this article we will demonstrate on examples how to limit data that the user can display/select in the selection fields of columns Value from a reference class. We are referring to records from other classes in these columns.

    Column Value from a reference class can refer to one or more records according to the settings and can also refer to the table with users.

    Column Value from a reference class (various classes) can refer to one or more records from more classes that are selected.

    Column type Reference to one or more records Reference to class Reference to user Reference to more classes
    Value from a referenced class Yes Yes Yes  
    Value from a referenced class (various classes) Yes Yes   Yes

    In case of column Value from a reference class we can let user select from all the records in the referred class or table with users or we can limit these groups. We have these possibilities:

    Restriction type Value from a reference class: Reference to class Value from a reference class: Reference to user
    Class for restricting records Yes  
    Filter Yes  
    Script Yes Yes
    User visibility   Yes

    Class for records restriction

    We can select a class for record restriction in the column Value from a reference class that can ensure that we will choose from relevant records. Imagine three classes according to the below scheme.

    1. List of projects - the other two classes refer to it
    2. List of subprojects - each Subproject belongs to one Project
    3. List of tasks - we choose Project, into which the task belongs to and then Subproject of the task

    THe question is how could we ensure  that users choose only from relevant Subprojects after selecting a Project (these Subprojects should belong to the selected Project). This can be achieved easily by this property. After creating all the columns in the class Task we choose in the definition of the column Subproject in teh combobox Class for record restriction proposed value Project.

    We can use this feature in one class for various columns repeatedly and narrow the range of records based on previous selections. Each column can refer to another class or to the same class in which the restriction is provided by a column refering to the class itself (self-reference).


    The below filter defines that the user will be provided only with records meeting the condition.



    Script provides us with the greatest flexibility in defining the logic that should be applied for defining records for selection. Below examples show assigning particular values that should be provided. They can be preceded by a complex logic and the assignment can use a variable.

    Below script used in the tab Reference at column Value from a referenced class enables to select from records defined by means of their Ids.

    OGDataRowFilter['active'] = true;

    var c = OG.DataRow.CreateConGe(OGDataParent.Columns['price'], 100); OGDataRowFilter.AddAndCon(c);

    Below script used in the tab Reference at column Value from a referenced class enables to select from two users (defined by means of their Ids).


    User visibility

    The visibility represents a complex solution of prohibiting access to information about other users. In contrast to previous examples user visibility is providing a whole instance solution (all the columns), not just one particular column and also determines display of page PersonQuickInfo. Every user then selects from users relevant within his/her context. The visibility is described in a special article.

    Value selection format

    We are choosing selection by a combobox (better for a smaller number of records) or by a search form (better for more record, it enables filtering the records) for columns Value from a referenced class. We can choose which columns should be displayed in the search form. In case of combobox the record is always represented by its short description. If the short description is not defined, then record FullId is displayed: , where X is class Id and Y is record Id.

    Example: Selection in the combobox

    Example: Selection in the search form

    In case of column Value from referenced class (reference to more classes) we are always selecting in a search form, in which we choose in the upper left corner which of the defined classes should be currently searched through.

    Data localization in search controls

    Referenced record can contain more language variants of a single text. There will be the variant according to user language setting displayed. It is necessary to check the option Localized text in the respective columns. This has to be done in the text column containing the data themselve (see below), in the column Short description (in the same class like the text column) and also in the column Value from referenced class, which contains reference to the localized data.