Contents

Lesson 7: Create a library of reusable functions

Create a library to format money values and to associate
category numbers with descriptions.Libraries contain functions, constants, and variables that
you can use in multiple locations.

When you reference a declaration
in the library from other logic such as a service or handler, you
can include the library name as a prefix. For example, MyLibrary.myLibraryVariable is
appropriate if the library name is MyLibrary and
the library includes the myLibraryVariable variable.
Alternatively, you can include the library name in a use statement
in the other logic and avoid the need to qualify every reference.
In that case, myLibraryVariable is sufficient to
reference that variable.

Create a Library part

To create a Library part:

Right-click the PaymentClient folder,
then click New > Library.

In the New EGL Library window, enter
the following information:

In the EGL source file name field, enter
the following name:
PaymentLib

In the Package field, enter the following
name:
libraries

Under EGL Library Type, leave the default
value of Basic selected.

The new Library part opens in the EGL editor.

Replace the boilerplate code in the Library part with the
following lines:
package libraries;
library PaymentLib type BasicLibrary {}
end