The Meta Instruction Set - Loops (cont.).

 Property loops.

The next two meta loops are very useful for looking at almost any triple in the model.

They are +For Each Property and +For Each Property Target. The first of these sets the triple CMSO and the second the CMSO of the target object type. They both take a verb as their parameter. They will work anywhere in meta code and will use the latest CMSO of the type appropriate to the verb parameter.

For instance, you want to get the length property of a field.

You would first need to arrange to get the field CMSO set. You can do this with the previously described +For Each Field loop.
Then you can use the
+For Each Property Target loop with the FLD length NBR verb. This would set the number CMSO to the length of each field in turn. You could then, for example, print this on a report describing your data model.

The class libraries use this technique to determine the maximum number of rows to return to populate a grid. The code is inside the Business entity.List attributes.Get sequential function:

You can see the use of both of the property loops here, as well as the ++Name Defined meta instruction. The number needed by the function is the target of the ... occurs NBR triple which is a continuation of the FNC variable VAR triple.

Note that this technique here works because the name of a number object is the same as the number it represents.

One other meta loop is illustrated in this piece of code. It is the +For Defined Value loop and this will be described in the next section which deals with meta variables.

Go to: Top : Next page