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

A customer writes:

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

This solution is less ‘elegant’ and more likely to encounter errors, but is easier to implement: 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

This solution requires a bit more work to implement, but the result is a more elegant and trouble-free setup: Create a posting setup as follows:

  1. Create an abacus containing just a 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. In the Inspector, set the command rectangle up as follows:
    1. In the ‘Command’ property popup, choose the Find First sequence.
    2. Set the Default Button property to on (checked).
    3. Click the ‘Conditional sequences’ button. In the Conditional Sequences dialog that opens, choose the Count abacus (created above) from the popup in the ‘Count’ column, and the Enter sequence (created above) from the popup in the ‘Sequence’ column.
    4. Click ‘OK’ to accept the change and dismiss the dialog.
    5. Click ‘Commit’ or ‘Commit All’ to save the changes.

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 running in the Classic Mac environment as far back as Helix Express 4.5.1, and probably further. (Earlier versions were not tested.)

This bug is fixed in the macOS versions of Helix (starting with 6.1 for Client and Engine, 6.2 for RADE) requiring the use of one of the alternate designs outlined above.

Attribution

Special thanks go to Fred Stephenson for discovering this problem.