Everything Else
Terminal Sequences in Helix 7.0

New in Helix 7.0, terminal sequences are those that end by closing the collection (or the connection, in the case of Helix Client).

Terminal sequences are useful in collections that are driven by interfaces where most actions are initiated by clicking buttons on a ‘control panel’ type view.

Terminal sequences are also useful for ‘end of day’ processing sequences that run after hours, and in other scenarios where it is desired that the collection be closed (or the Client disconnected) without requiring the user to access a menu command.

Note that when this technote refers to closing a collection, in the case of Helix Client it should be understood to mean closing a connection (i.e. disconnecting) from Helix Server.

Defining ‘Terminal’ Sequences

Two commands have been added to the list of Helix commands that can be used in sequences: Close Collection and Quit. These are referred to as terminal steps. Sequences that contain a terminal step are referred to as terminal sequences, since they ‘terminate’ access to the collection.

In the case of Helix RADE and Helix Engine, terminal sequences act on the collection that is currently open in that application.

In the case of Helix Client, terminal sequences act on the Client’s connection to the Server. Terminal sequences have no effect on the Server, other than to disconnect the Client from which the terminal sequence is run.

Creating Terminal Sequences

Terminal sequences are created by adding the Close Collection or Quit command as a step to a sequence. All of the standard methods for adding steps are allowed:

  • Drag and drop the command from the Element Panel
  • Drag and drop from another sequence icon’s step list
  • Drag and drop from a user icon’s menu item
  • Use an AppleScript add … command statement

Because the result of these commands is the end of database operations, they can only be the last step in a sequence. Helix blocks attempts to add a terminal step prior to another step, and blocks attempts to add other steps after a terminal step.

Only one terminal step may be included in a sequence. (The Quit command automatically closes the collection, just as it does when invoked from a menu.)

When a terminal sequence — or one that has a terminal sequence nested within it — is being edited, the terminal step commands are suppressed in the Element Panel, to indicate that they can not be added.

A terminal sequence can be used as a nested sequence, embedded within another sequence, but only as a final step.

A terminal sequence can be used as a conditional sequence, making it possible to create a conditional sequence chain that includes subsequent sequences after a terminal sequence. If the condition for the terminal sequence is satisfied and that sequence runs, all subsequent sequences in the conditional chain are bypassed. (This is a logical extension of the fact that closing a view that invokes a conditional sequence chain terminates that chain after the current conditional sequence returns.)

Terminal Sequences and User Response Dialogs

The setting of a terminal sequence’s Show dialogs property controls whether dialogs are presented to the user. When Show dialogs is set to…

  • Always: the Save changes before… dialog is presented to the user.
  • Optionally: the Save changes before… dialog is presented to the user if the Option key was held down when the sequence was invoked.
  • Never: the Save changes before… dialog is never presented to the user.

If the Save changes before… dialog is not presented to the user, the assumed response is “Save Changes” — the collection is automatically saved before it is closed.

Even when a terminal sequence does not show dialogs, views with unentered changes prompt the user to enter or discard the record before terminating collection access, just as if the corresponding menu item had been invoked.

Terminal Sequences and Tail Recursive Sequences

A tail recursive sequence is one whose last step is to call itself, thereby creating a loop (or recursion) that repeats until some condition (such as an error) causes it to stop. All recursive sequences in Helix are tail recursive, since the recursive step must be the last step in the sequence.

As such, tail recursion and termination are mutually exclusive: a sequence can not be both tail recursive and terminal.