company logo

OSI expressions and functions

OSI expressions and functions differ only in the fact, that OSI functions always need a head line, while OSI expressions consist of a single statement, which also may be defined as block containing several statements internally, or also as block containing VARIABLES and PROCESS sections.

Expressions can be called directly by calling executeExpression() or may be referenced in an operation path by function name or as inline expression. Referring to an expression by name requires, that an appropriate OSI function has been implemented in the class the operation applies on (preceding path element or calling property handle for the first path element). OSI expressions may be defined in the resource database (dictionary) or may be loaded from an OSI directory when opening the database (see OSI_Library in the data source definition).

When recalculation of person's age has been defined in an OSI expression CalculateAge() in the person class, recalculating the age for all persons could be achieved by the following expression:

// calling pre-defined expression with object space habdle

  obh.ExecuteExpression("Person::Persons()->CalculateAge");

// calling pre-defined expression with property habdle

  Property         person(obh,"Person::Persons",odaba::Update);

  person.ExecuteExpression("CalculateAge");

// referring to pre-defined expression

  Property         p_age(obh,"Person::Persons()->CalculateAge");

  p_age.Execute();

  

// referring to inline expression

  Property         p_age(obh,"Person::Persons()->{age = Date.Year - birth_date.Year;}");

  p_age.Execute();