|TS2474: Post All and the Max tile|
Classic bug that allowed an unsupported construction to work under specific conditions.
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?
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:
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:
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.
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.
Special thanks go to Fred Stephenson for discovering this problem.