A layout is based on a Table Occurence and "contains" records from that Table Occurence. So when you perform a find, the layout provides the context. A find won't affect your layout per se. Maybe I'm missing something important.
That is the point. I don't want the lay out to provide the content. I only want to know how many records there are (with the same "Contract Code"), to use this number (of records with the same value) to get a value for use in the Contract Number.
All scripts run within the context of a specific layout. But a script can freeze the window, change layouts, do what is needed and then return to the original layout. If the layout that the script changes to in order to perform your find, is either based on a different Tutorial: What are Table Occurrences? or opened in a different window, that find will have no effect on the found set in your original layout.
But a relationship can also return the maximum value for a set of related records and thus your script need not actually perform any find at all.
This makes sense. I will have to find out what the best way is to find the number of records, or a second table occurrence or related records. It seems a relationship is the most effective way. I already put the "Contract Code" temporary in a global field, so I could use this global field for the relation and count he number of related records.
Thanks again Phil.
The "Freeze Window" is interesting to Phil (for other purposes). And in English I immediately understand what it is doing. Now I will try to find the Dutch expression for "Freeze" and "Unfreeze".
There is no "unfreeze" window script step, just freeze window. It simply keeps the window from updating due to the change in layout or found set until the script either performs a step that forces an update such as refresh window or the script finishes execution.
O.K. I understand that Phil.
Just a question, I have been looking for the Dutch expression for getting the number of related records in a table occurrence. Can you give me the English expression? (Maybe it makes it easier to find the Dutch one).
There is more than one way to do that.
If you have:
And, for a given record in ParentTable, you want the count of all records in ChildTable linked to it,
Count ( ChildTable::NeverEmptyField )
will return the count of records related to the current ParentTable record.
But ChildTable::SummaryField can return the same value if it is set to "count" a never empty field.
And ExecuteSQL can also return this same count.
This is clear. Where I went wrong: I was looking for a "Get" function (to get the number of related records), but I can simply use the count function.
Thanks again for your help Phil.