UI scripts

The default behavior of a session is handled by the 4GL engine. If you require additional functionality or want to bypass the default functionality, you program your changes in the session's UI script (Program script). The UI script is compiled in the session object. The object contains only the exceptions to the normal operating procedures of the system. The 4GL Engine executes the normal operating procedures of the system, and you write the exceptions.

The UI script contains events to hook into the 4GL Engine, and describe the actions that should happen as a result of an event. Events trigger code. When the session runs and an event triggers, the 4GL Engine uses the session object to perform the appropriate actions.

Actions that could take place as the result of an event are:

  • Calculate a field value before a field displays.
  • Synchronize the current (parent) session with a child session when you run a form command. For example: a parent session that uses the Orders table is synchronized with a child session that uses the Order lines table.
  • Send a file to the user’s PC when you save a record.

The syntax of the UI script contains complete programming syntax capabilities such as variable declarations, expressions, operators, transfer of control, iterations (loops), functions, embedded SQL, and a full featured functions library.

Note

As a developer, you must be diligent to provide only user interface elements in the UI script. Logical integrity and business logic elements will be added in the Data Access Layer (DAL).

Event sections

UI scripts consist of one or more event sections in which you program actions to be performed at particular states of execution of the 4GL Engine. It is not necessary to program all sections; only those for which you need to provide the required functionality. The statements programmed in a section can be a combination of 3GL/4GL functions and 3GL statements.

The event sections are categorized. A section type consists of a main section and, for most section types, subsections. A main section indicates the object for which the programmed actions must be executed. A subsection specifies when the actions must be executed. The section types are:

Section TypeMain sectionSubsections
ProgramYesNo
Zoom FromYesYes
FormYesYes
GroupYesYes
ChoiceYesYes
FieldYesYes
Main TableYesYes

 

Field sections are only used for non-table fields, table fields are handled by the DAL script.

Main table sections must not be used anymore, because the logic for the Main table is done via the DAL.

For more information, refer to the "Event sections" subtopic in the "4GL Language Features" topic in the Infor ES Programmer's Guide. The related help topic for the Flow of the 4GL engine is useful for advanced developers to understand event loops and the sequence of events in the 4GL engine.

To create UI scripts

You can create and edit UI scripts in the Program Scripts / Libraries (ttadv2530m000) session. When you create a new session in the Sessions (ttadv2500m000) session, a corresponding UI script is generated automatically.