DataItem NumberOfCars INT {} end
carCount NumberOfCars;
The variable carsInPolicy refers to the number of cars in an insurance policy. You can use the name of a DataItem part to focus on a business issue.
Record CarPolicy type BasicRecord {} policyID STRING; carCount NumberOfCars; driverCount NumberofDrivers end
myCarPolicy CarPolicy; myCarPolicy.policyID = "ABC123"; myCarPolicy.carCount = 2;
Much of your work with EGL might involve primitive types, DataItem parts, and Record parts.
For further details about data parts in EGL, see “User-defined data parts” and “System data parts."
You define logic parts to process data or to access code that processes data.
Some logic parts can have a set of functions that include local variables and constants. Such parts also can have a set of variables and constants that are program global: available to every function in the part.
When you define a part that uses the code in a library, you can specify a use statement in that part. The use statement identifies the library to the part so that you can avoid repeating the library name when you reference the functions, variables, and constants in the library. For details, see “use.”
Each of these parts is similar to a data part and is intended to be the basis of a variable.
For further details about prototype parts, see “Logic parts.”
The workbench uses generatable parts to start a generation process. For example, the workbench might start generation with a Service part and then continue with non-generatable parts, such as the DataItems and Record parts that are used by the Service part.
The generatable parts are Handler, Service, and DataTable. Library is also treated as a generatable part, but is generated only when the Service or Rich UI handler is generated.
Keep collections of Record parts and DataItems in files that do not have a generatable part. This practice gives you more modular code and is especially useful over time, for easier maintenance.
An important part of EGL syntax is the set-value block, which is the area between curly brackets in a part definition or variable declaration. In a part definition, you use set-value blocks to assign property values for use during EGL build or generation. In a variable definition, you use set-value blocks to assign runtime values.
myCarPolicy CarPolicy { policyID = "ABC123", carCount = 2 };
For further details about set-value blocks, see "Set-value blocks."
const MYCONSTANT01, MYCONSTANT02 INT = 5; myVariable01, myVariable02 INT;
In general, the use of reference variables gives you flexibility; however, when you copy data to or from a reference variable, you need to know the processing implications.
myFlexibleVariable Any = new Any;
For further details about variables, see “Declaring variables and constants.”
Most of your work with arrays is likely to involve a dynamic array, which is an array whose number of elements is changeable at run time. You make a size change by invoking an array-specific function, such as removeElement, insertElement, or appendElement.
myINTArray INT[] = [1,2,3]; my2Dimension INT[][] = [[1,2],[3,4]]; mySTRINGArray STRING[] = ["bye", "ciao"]; myBooleanArray BOOLEAN[] = [ (myPay < 10000), (yourPay > 50000) ];
For further details about arrays, see “Arrays.”
An expression is a sequence of operands such as constants, variables, literals, and function invocations; operators, such as + and -; and special characters such as parentheses. At run time, each expression resolves to a value of a specific type.
For further details, see “Expressions and operators.”