1. Script object OG.DataRow

    Article: AN0002162Updated:

    This object provides functions for work with data.

    Script functions

    Name Description
    DataRowList GetDataByFilter(DataRowFilter filter) Function returns records according to the input filter.
    DataRowList GetDataByFilter(DbTransaction trans, DataRowFilter filter) Function returns records according to the input filter.
    DataRowFilter GetDataRowFilter(int parentId) Function returns filter with pre-set ParentId.
    DataRowFilter GetDataRowFilter(int parentId, int id) Function returns filter with pre-set ParentId and Id.
    DataRowFilter GetDataRowFilter(Model m, string clqcode, int id) Function returns filter with pre-set ParentId and Id. Class/query is searched according to the code clqcode.
    DataRow GetDataById(int parentId, int id) Function returns record according to the ParentId and Id. Id such a record does not exist, NULL is returned.
    bool ExistRowByFilter(DataRowFilter filter) Function finds out if at least one record exists according to the input flter. If it exists, it returns True, otherwise False is returned.
    void SaveData(DataRow dataRow) Function saves one record into a class.
    void SaveData(DataRowList dataRowList, bool allInTransaction) Function saves more records into a class with/without a transaction.
    void DeleteData(DbTransaction trans, int id, int parentId) Function deletes one record from a class.
    DataRow CreateNew( int classDefId) Function creates one record and sets a class for him. The record is not created in the class (in the database). Only an object is created and returned by the function.
    DataRowList CreateNewList() Function creates a new collection for storing objects from DataRow.
    DataRowList GetAllDataByCode(string mCode, string clqCode, bool onlyActive)

    Function returns all the records from the class or query. By the parametetr onlyActive you can set that only active (not deleted) records shall be returned.

    Function can be used e.g. to reading from master data (reference) tables.

    DataRowList GetAllDataByCode(Model m, string clqCode, bool onlyActive)

    Function returns all the records from the class or query. By the parametetr onlyActive you can set that only active (not deleted) records shall be returned.

    Function can be used e.g. to reading from master data (reference) tables.

    DataRow GetPersonDataRow(int personId) Function returns for record for the input user from the class extending user properties.
    void PrepareFilterForOptimizeRead(DataRowFilter filter) Function initializes filter for optimization of reading from the database.
    int? SplitFullId(string fullId, int part)

    Function returns part of the record full id (Id of the class/query or Id of the record).

    Parameter part can contain:

    1 - Id of the class/query is returned

    2 - Id of the record is returned

    other value - NULL is returned

    If an erroneous fullId is input, NULL is returned.

    void CreateTypeRowsint sourceTextColumnId, int sourceClasslinkColumnId, int destinationalTextColumnId) Function is used for extraction of data into reference class and update of the link between data.
    DataRow GetDataRowByCode(DbTransaction trans, IClassDefBase dataParent, string value) Function returns record from the class, where column with code "code" equals value value.
    DataRow GetDataRowByCode(DbTransaction trans, IClassDefBase dataParent, string value, string code) Function returns record from the class, where column with code according to parameter code equals value value.
    ConditionBase AndCon(ConditionBase c1, ConditionBase c2) Function associates two conditions with operator AND.
    ConditionBase AndCon(ConditionBase c1, ConditionBase c2, bool addEnvelope) Function associates two conditions with operator AND. If set to TRUE, parameter addEnvelope encloses conditions with a bracket.
    ConditionBase AndCon(ConditionBase c1, ConditionBase c2, ConditionBase c3, bool addEnvelope) Function associates two conditions with operator AND. If set to TRUE, parameter addEnvelope encloses conditions with a bracket.
    ConditionBase AndCon(ConditionBase c1, ConditionBase c2, ConditionBase c3, ConditionBase c4, bool addEnvelope) Function associates two conditions with operator AND. If set to TRUE, parameter addEnvelope encloses conditions with a bracket.
    ConditionBase OrCon(ConditionBase c1, ConditionBase c2) Function associates two conditions with operator OR.
    ConditionBase OrCon(ConditionBase c1, ConditionBase c2, bool addEnvelope) Function associates two conditions with operator OR. Function associates two conditions with operator AND. If set to TRUE, parameter addEnvelope encloses conditions with a bracket.
    ConditionBase OrCon(ConditionBase c1, ConditionBase c2, ConditionBase c3, bool addEnvelope) Function associates two conditions with operator OR. Function associates two conditions with operator AND. If set to TRUE, parameter addEnvelope encloses conditions with a bracket.
    ConditionBase OrCon(ConditionBase c1, ConditionBase c2, ConditionBase c3, ConditionBase c4, bool addEnvelope) Function associates two conditions with operator OR. Function associates two conditions with operator AND. If set to TRUE, parameter addEnvelope encloses conditions with a bracket.
    ConditionBase NotCon(ConditionBase c) Function adds negation before the condition.
    ConditionBase EnvelopeCon(ConditionBase c) Function encloses condition with bracket.
    ConditionEq CreateConEq(ColumnClassDef column, object value) Function creates a condition, where the value is equal to value from column.
    ConditionGe CreateConGe(ColumnClassDef column, object value) Function creates a condition, where the value is equal to or greater than value from column.
    ConditionGt CreateConGt(ColumnClassDef column, object value) Function creates a condition, where the value is greater than value from column.
    ConditionLe CreateConLe(ColumnClassDef column, object value) Function creates a condition, where the value is equal to or less than value from column.
    ConditionLt CreateConLt(ColumnClassDef column, object value) Function creates a condition, where the value is less than value from column.
    ConditionIsNotNull CreateConIsNotNull(ColumnClassDef column) Function creates a condition, where column is not NULL.
    ConditionIsNull CreateConIsNull(ColumnClassDef column) Function creates a condition, where column is NULL.
    ConditionSql CreateConSql(string sql) Function creates a condition, where according to the input SQL.
    ConditionLike CreateConLike(ColumnClassDef column, string value) Function creates a condition, where the value is included in the column. The search is done by means of function LIKE ("column like %value%").
    ConditionLike CreateConLike(ColumnClassDef column, string value, bool startLike, bool endLike)

    Function creates a condition, where the value is included in the column. The search is done by means of function LIKE ("column like value").

    Parameter startLike adds operator % before the value.

    Parameter startLike adds operator % after the value.

    ClassDefEntityType ClassDefEntityType_ClassDef Typ entity ClassDef. Hodnota se používá v DataRowFilter.
    ClassDefEntityType ClassDefEntityType_Query Typ entity Query. Hodnota se používá v DataRowFilter.

    Function GetDataRowByCode is used for a fast look up of a record from another class (e.g. status from master data). As a prerequisite there has to be a text column with code "code", according to which the record is looked up. The second variant of the function enables to enter in the parameter code code of the column, in which the search shall be performed.

    This function avoids creating a filter and reading data from the class. Therefore, everything can be managed in a single script row.

    Method PrepareFilterForOptimizeRead checks properties PropertiesLoad and PropertiesLoad.ColumnIds, and if they are NULL, it creates an instance for them.

    Object call

    OG.DataRow

×