For all variables within an expression a type should be defined explicitly.
Syntax |
// Declaring a variable // Declaring and initializing a variable |
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; while ((@results = @sr.GetObjects(@bulksize)) != null) { %%TRACE("Fetched chunk of search results", @results); @results.ProcessOrder(); |
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.
Example |
usecase OnUserAndGroup(any memberof) { expression { if (cooobj.HasAttribute(cootx, #usersurname)) { assume User cooobj; assume Group[] memberof; } } |
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() { application { expression { assume in string sys_branchvalue; assume out ::ru; … } } } |
The keyword assume can also be used to declare the types of dictionary entries, especially the cardinality.
Example |
usecase UpdateUser(dictionary datainput) { expression { assume string datainput.name; cooobj.objname = name; assume integer[] datainput.weights; } } |