1. Data functions

    Article: AN0002149Updated:

     

    Function name and parameters Function description
    IsDeletedRecord() Function returns True if the record is deleted. (Returned value is data type boolean.)

    Example:

    Column('order') >= 10 && (!IsDeletedRecord())

    Stated expression is True if there is value 10 or higher in the column order and the record is not deleted at the same time.
    IsNewRecord() The function returns True if the record is new (not saved yet). (Returned value is data type boolean.)
    IsOverRelationCount('classlink', only_active_records, max_number)
    IsOverRelationCount('classlink', only_active_records, 'column_with_max_number')
    This function deals with class relation cardinality. The function is used in context of a certain class – by means of use in rules. Parameter 'classlink' is the name of the class with which the given class has relation, cardinality of which we want to manage. Parameter only_active_records sets, if only active (logically not deleted) records or all the record (this parameter can be true/false). The first variant of the function contains the third parameter max_number, that keeps max. number of relations (referred records) of the class with class in the 'classlink' parameter. In this way you can set a value valid for all the records from the class 'classlink'.

    The second variant of the function contains the third parameter 'column_with_max_number' that contains name of the column from the class in the parameter 'classlink', that contains value with max. number of relations. In this way you can set an individual value with max. number of relations for each record from the class classlink individually.

    (Returned value is data type boolean.)
    GetRelationCount(‘columncode’, only_active) Returns number of links to the entered value in the column according to the first parameter. If it is used in a rule applied before saving the record, it takes into account also the value of the saved record. The second parameter defines wheather only active (not deleted) records or also logically deleted records should be taken into account.(Returned value is data type integer.)
    IsNull(p1, p2) Returns the first parameter if this parameter is not null. If the first parameter is null, it returns the second parameter:

    Example:

    IsNull(column('specialvalue'), column('defaultvalue'))
    AddLink(column(’code1’), column(’code2’)) The function takes values from the column according to the second parameter and inserts into the column according to the first parameter those, that are not in this column yet. Both columns have to be a reference to a class or both reference to a user. The column according to the first parameter has to be a multireference – reference to N records.

     

    Example:

    AddLink( Column(’teammembers’), column(’manager’))

    The function adds user from the column manager to users in the column teammembers. This makes sure that manager is always considered to be a teammember.
    Column('code') Returns value from the column of the code according to the parameter. The function is used in the context of a particular class and particular record.

     

    Note:

    Always put the function Column('code') by comparing with a string into the function IsNull(p1, p2) as parameter p1. In case that the value in column code is null comparison still can be evaluated.

     

    Example:

    IsNull(Column('code'), ‘XXXX’) = ‘string‘
    Column('code', ‘id’)
    Column('code', ‘text’)
    Column('code', ‘count’)
    In case of columns with reference we can use function with two parameters. The first parameter is code of the column. The second parameter is the required type of the returned value:

    id – returns Id of the referred record (only for simple references)

    text – returns short description of the referred record (only for simple references)

    count – returns number of records in the reference

    ForeignColumn(‘class_code‘,‘column_code‘,record_id) Returns value from the class of given code, column of the given code and record of the given Id.The function can be used e.g. in rules for ensuring class relation cardinality (together with function Column and IsOverRelationCount or GetRelationCount), when number of posible relations to particular records of certain class is stated in a special column of this class.
    RangeId( value, model code, class code, code of column from, code of column to, include from, include to)

    Returns id of the first record from the entered class, that meets the condition that the entered value is in range according to the last four parameters.
    If include from and include to are true, then also border values from the columns are included.
    If no model code is entered, then model from the currently processed record is used.

    Example:

    RangeId( column('value'), '', 'class-range', 'col-from', 'col-to', true, true)
    RangeId( column('value'), 'model-x', 'class-range', 'col-from', 'col-to', true, true)

     

    Search can be done in columns of the type integer, decimal or date.

     

×