2017 June Release

TypesPermanent link for this heading

For all variables within an expression a type should be defined explicitly.

Syntax

// Declaring a variable
Type variable;

// Declaring and initializing a variable
Type variable = initialValue;


Valid types are object classes and objects of the class COOSYSTEM@1.1:TypeDefinition, which includes basic data types (such as COOSYSTEM@1.1:INTEGER, COOSYSTEM@1.1:STRING or COOSYSTEM@1.1:DATETIME) as well as compound types and enumerations.

Shortcuts are provided for basic data types as defined by the object model language (see chapter “Simple data types”) as well as Fabasoft Folio Kernel Interfaces as listed below.

Type

Description

runtime

The type for a Fabasoft Folio Runtime Interface, such as the predefined symbol coort.

transaction

The type for a Fabasoft Folio Transaction Interface, such as the predefined symbol cootx. An interface of this type is returned, if you create a new transaction using coort.CreateTransaction().

method

The type for a Fabasoft Folio Method Interface, such as the predefined symbol coometh. An interface of this type is returned, if you obtain the implementation of a use case using cooobj.GetMethod().

searchresult

The type for a Fabasoft Folio Interface to the result of an asynchronous search, as returned by coort.SearchObjectsAsync().

expression

The type for a Fabasoft app.ducx Expression interface, as returned by coort.Parse().

aggregate

The type for a Fabasoft Folio Aggregate Interface, which can be used as a generic substitute for any compound type.

interface

A generic type for a Fabasoft Folio Interface.

Table 36: Types for Fabasoft Folio Kernel Interfaces

Example

integer @bulksize = 150;
string @query = "SELECT objname FROM APPDUCXSAMPLE@200.200:Order";
searchresult @sr = coort.SearchObjectsAsync(cootx, @query);
Order[] @results = null;

while ((@results = @sr.GetObjects(@bulksize)) != null) {

  %%TRACE("Fetched chunk of search results", @results);

  @results.ProcessOrder();
}

Redeclaration of variablesPermanent link for this heading

Sometimes the known types of variables are not known or not specific enough to write expressions without warnings. This can be fixed using the keyword assume. assume tells the app.ducx compiler the correct type. The compiler creates some assertions for these variables, but no declarations.

Example

usecase OnUserAndGroup(any memberof) {
  variant User, Group {

    expression {

      if (cooobj.HasAttribute(cootx, #usersurname)) {

        assume User cooobj;

        assume Group[] memberof;

      }

    }
  }

}

Declaration of available variablesPermanent link for this heading

Some scopes can contain variables which are not documented. Should this be the case and the developer wants to access these variables, the keyword assume can be used, too. In this case the assume statement is written like a parameter declaration, specifying input/output modifier.

Example

usecase SetReturnURL() {
  variant User {

    application {

      expression {

        assume in string sys_branchvalue;

        assume out ::ru;

        …

      }

    }
  }

}