Segment Cycle

The segment cycle is the processing cycle that occurs when the application executes an ispec or event transaction. It is controlled by the segment and defines the order in which built-in methods are called.

Note: In the following text of this topic, the term ispec should be read to denote both ispecs and events.

The following diagram is of the basic segment cycle:

Requesting an Ispec

An ispec can be requested as a result of one the following:

When an ispec is requested, the following process steps occur before the ispec is ready to accept input (for ispecs with a user interface, this corresponds with its display to the application client). The orange arrow in the diagram above indicates the starting point:

  1. Segment and ispec attributes without defined initial values are initialized to their corresponding values from the input message.

  2. The Construct method is called unless either the ispec is being requested due to an automatic refresh and a Message logic command has not been invoked, or the ispec has not been requested as a result of a Recall logic command invoked by the same ispec.

    The Construct method can be used for reasons such as the pre-filling of user interface fields, or security checking.

Transmitting an Ispec Update

An ispec update initiates the following process steps (the green arrow in the diagram above indicates the starting point):

  1. Segment and ispec attributes without defined initial values are initialized to their corresponding values from the input message if they are in the presentation, or to the appropriate "empty" value (0, "", or false), depending on the attribute type.

  2. Automatic edit occurs – attributes with decimals are validated.

    Any errors are returned to the application client.

  3. The Prepare method is called.

    The Prepare method can be used for reasons such as generating a customer number, performing any necessary validation of user input data, performing logic actions based on the user input, or recalling another ispec without processing the current ispec.

    Any Message or Recall logic commands invoked halts processing at the end of the prepare method.

  4. Automatic validation occurs – keys, dates, and required fields are validated; the database records corresponding to the specified keys are retrieved if they have an automatic lookup dependency.

    Any errors are returned to the application client.

  5. The Main method is called.

    The Main method can be used for reasons such as checking stock-on-hand, or checking a customer credit limit for a sale.

    Any errors are returned to the application client.

  6. Automatic update occurs – for a persistent ispec, the database record is updated (or written).

  7. At this point, one of the following process steps occurs:

    • If a Recall logic command was invoked on the same ispec, the Construct method call is skipped, and the segment cycle repeats from step 1 above.

    • If a Recall logic command was invoked on a different ispec, the specified ispec is requested. Refer to Requesting an ispec for more information.

    • If the ispec's Refresh Screen property is set to true, and no Recall logic command was invoked, the current ispec is requested. Refer to Requesting an ispec for more information.

    • If the ispec's Refresh Screen property is set to false, and no Recall logic command was invoked, the Select Ispec dialog box is displayed. Refer to Requesting an ispec for more information.

Transmitting an Ispec Inquiry

An ispec inquiry occurs when an ispec is transmitted with Maint built-in presentation attribute is set to "FIR", "LAS", "NEX", "BAC", or "REC". It initiates the following process steps:

  1. Segment and ispec attributes without defined initial values are initialized to their corresponding values from the input message.

  2. Automatic edit of keys occurs – numeric fields are validated, separators and decimal points are removed.

    Any errors are returned to the application client.

  3. The database record corresponding to the specified keys is retrieved.

  4. The retrieved record is made available (for ispecs with a user interface, this corresponds with its display to the application client).

Glb.Error

The behavior of the segment cycle is affected by the Glb.Error built-in segment attribute in the following manner:

Ispec Cycle

The ispec cycle is a subset of the segment cycle and consists of the processing of an input message by a single ispec. It is controlled by each individual ispec.

The ispec cycle can also be called independently of the segment cycle, such as with external automatic entry processing.