|
|
| 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 OS X Helix. If you rely on this technique, you will need to revise your code for OS X Helix. 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. When we do address it, we expect to implement it logically, so that Hot Forms increment the counter and Cold Forms do not. |
| Solution #1: Recursive Sequence |
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 |
Create your 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. |
| 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. |