Product
Support
Everything Else
TS2474: Post All and the Max tile
Category

Classic bug that allowed an unsupported construction to work under specific conditions.

The Problem

I tried to assign sequential numbers to a bunch of records using “max + 1” but they all came out with the same number. How do I number these pre-existing records?

Discussion

The obvious way — using “Find and Post All” from an entry form or “Post All” from a list — is not supported by Helix. However, a longstanding bug causes it to work in Classic Helix, but only when the posting is done from a Cold Form. (A Cold Form is one with the Keep Current attribute turned off.)

The logic of Cold Forms vs Hot Forms implies the opposite effect. (Hot Forms should increment the number, Cold Forms should not.) The fact that Cold Forms do appear to work correctly (but they too can fail under certain circumstances) is a quirk caused by a bug in the Cold Form code.

The underlying bug in Cold Forms has been fixed in the macOS version of Helix. If you rely on this technique, you will need to revise your code. Our suggested approach is to use either a recursive or conditional sequence to iterate through the records, assigning the sequential numbers one by one. (See below.)

Although we agree that this construction is a logical (and easy) way to accomplish the desired result, we are not planning on adding this feature to Helix in the foreseeable future. Should we chose to address it, we expect to design it logically, so that Hot Forms increment the counter and Cold Forms do not.

Solution #1: Recursive Sequence

Create a sequence containing three steps:

  1. Static Enter (or Static Enter Override)
  2. Find Next
  3. The sequence itself

By inserting a sequence as the last step within itself, it repeats (recurses) over and over, potentially forever. However, the Find Next step will generate an error when there are no more records to find, terminating the sequence. It is your responsibility to make sure the view is positioned at the first record before the sequence is run and to handle the error that occurs when all of the records have been processed.

Solution #2: Conditional Sequence

Create your posting setup as follows:

  1. Create an abacus containing the Form Count tile.
  2. Create a sequence containing just one step: Find First.
  3. Create another sequence containing just one step: Enter (or Enter Override).
  4. On the template on which the posting is to occur, create a command rectangle (a button).
  5. Open the command rectangle (to access the Options dialog) and set it up as follows:
    1. Attach the Find First sequence as the ‘Primary’ sequence (on the left).
    2. Turn the Default Button attribute on.
    3. Click the ‘Options’ button and …
    4. Add this conditional sequence: choose the Count abacus (created above) in the On Condition list, and the Enter sequence (created above) in the Run Sequence list. (Be sure to click the Add button so the statement appears in the Final list at the bottom of the dialog.)
    5. Click ‘OK’ in both dialogs and save the template.

Instead of relying on an error condition to stop the sequence, this technique knows in advance (via the count abacus) how many records need to be entered, so the conditional sequence runs only the required number of times. You can then add more processing (if necessary) by adding subsequent lines to the conditional sequence list. It is your responsibility to make sure the user runs the sequence by triggering the button. Conditional sequences can not be invoked via menu selection.

If this process is part of a larger process, you can use the Keypress: Enter sequence command to trigger the default sequence on this view.

Sample Code

A collection demonstrating the bug along with both alternative methods is available on our FTP server, or as a direct download by clicking here.

Scope

This bug affects all Helix applications: RADE, Engine & Client/Server.

This bug exists in all versions of Helix as far back as Helix Express 4.5.1, and probably further. (Earlier versions were not tested.)

Attribution

Special thanks go to Fred Stephenson for discovering this problem.