I was reminded of this in a support call this week, where the user had a pride-and-joy procedure with a beatiful, bouncing layout ... and they wanted to make what seemed like a simple change. They added a line of code before the main 'for' loop that checked to see that a value in the data-entry form was set:
if data-entry MyValueToCheck = blank then exit . end .
Why would such a simple addition bring the roof down? Because it changes the data model.
Basically -- and this is another golden rule -- for every document, there can only be one parenting table. Perhaps less obvious is that this 'if' command required something to parent it ... and in these instances Ffenics and DataEase inserts its standby DQL Scheduler. Try it and see:
- Mock up a simple for/list records
- Accept the default body
- Move one of the fields just to highlight that it is changed
- Add an if command above the for (try 'if year ( current extended date ) = 2010 then exit . end .')
- Compile and accept the default 'merge changes' for the new layout.
- Note than previously moved field is back to its default position.
- Go to Document -- View Data model to see that the DQL Scheduler table has been inserted at the left.
In the meantime, there are several workarounds (other than start again...):
- Add the sense of the 'if' to the selection criteria for the main 'for' ('for MyTable with data-entry MyField not = blank' )
- Add the 'if ... exit ... end' statement as is immediately after the 'for MyTable'
- Add some logic (e.g. make the field required) to the data-entry form/interactive header to do the check for you in the first place.