The
part is an independent part of an application.
No part can exist inside of another part. Parts can be as large as
a Program, or as small as a single DataItem. You use three main kinds
of parts in EGL programming:
- Data parts contain values.
- Logic parts perform operations on data.
- User Interface (UI) parts provide specialized data structures
for interaction with a user.
Main parts such as FormGroups, Libraries, and Programs
have the same name as the source file. You can create source files
that have no main parts at all; for example, to store some kinds of
data parts.
A variable is a named entity in either an EGL logic
part or Record. Variables are based on data parts, which means that
a variable reserves storage for a particular kind of data. For more
information, see Variables.
If you declare a variable or constant in a part, that identifier
is in scope throughout the part:
- If the declaration is in a function, the identifier is in the
local scope of the function. For example, if the function getCustomer() declares
the variable runningBalance, any code in getCustomer() that
follows the declaration can reference runningBalance.
You
can pass the variable as an argument to another function, but the
original identifier is not available in the called function. Instead,
the name of the corresponding parameter in the receiving function
declaration is available in the called function.
- If the declaration is in a main part (such as a Program) but is
outside of any function (including the main() function),
the name is global to that part. Refer to the name without
qualifying it in any function called by the part. For example, if
a program declares runningBalance outside of a function
and invokes getCustomer(), which in turn invokes getCustomerBalance(), runningBalance is
available throughout both functions.
The names in a text or print
form are global to the main part that references the form. Those names
are available even if the form is not presented.
- If the declaration is in a Library part, but outside of a function,
the identifier is in scope within the run unit (a set
of programs that operate together; see Run unit).
- For an explanation of scope issues relating to a DataTable part,
see DataTable part.