The Meta Instruction Set - Generated tests.

Let's look at some more of the meta instructions available.

Bear in mind that only valid lines of action diagram code can be generated. If the meta code would cause an invalid statement, the instruction is ignored during generation. If the instruction is a block, all the code inside the block is also ignored. An example of an invalid line of code would be a test to see if a numeric field started with a character string.

Note: Not all of the instructions in any group will be discussed here. The more complex or esoteric ones will be left until later.

Generation.

All of the instructions which cause real code to be generated start with ++. Most have real code equivalent instructions.

They fall into three groups: Tests, Assignments and Function calls.

Tests.

The simplest of these instructions are in the following table. They start with ++If, except ++Else, and require the current meta source object to be a field in a variable.

++If Empty True if the field is empty at runtime.
++If Not Empty True if the field is not empty at runtime.
++If Focus True if the field currently has focus on the panel.
++If Input Capable True if the field on the panel currently is input-capable.
++Else Generates an Else statement when there is a corresponding If statement.

These are all employed in the Obsydian Class Libraries in one way or another. For instance, the ++If Focus is used when prompting is requested, to find the field with focus, and call the appropriate Select function. Look in the Prompt processing meta function in OBASE. This function also uses the ++If Input Capable instruction to check that the field with focus is editable by the user.

++If <OP> <Variable>

A slightly more complex version of ++If takes a logical operator and a variable as its parameters. The logical operator is one of the following: EQ, NE, LT, LE, GT, GE, ST and CT. These are equal, not equal, less than, less than or equal, greater than, greater than or equal, starts with and contains. The meta generator constructs an If statement with the corresponding test, comparing the current field to the same field in the parameter variable. If the field does not exist in the variable, no code is generated for that field. The ST and CT operators are only valid for character type fields and so if a field of another type is encountered, no code is created.

The sequence of the fields in the logical test is important, so you need to think about which variable is used to form the meta loop and which is used as the parameter to the ++If.

The client-side data filtering employs all of the operators with this meta instruction. Look in any function inherited from Business entity.Standard functions.List instances user interface to see the how the code is constructed. The following picture is just a small part of the sub-routine:

++If <value>.

Checking to see if a field has one four the special values: Null, Empty, High or Low - is another test you can get generated.

Each of these has its own verb and, if the field that is the current meta source object has the verb, an If instruction is generated. The <value> is specified in the short form of the verb, FLD null VAL for example. This would test to see it the field is in the NULL state at runtime, assuming the field has the verb in the model.

This test does not look at the content of the field in question. Instead it tests the state of the field and the only way to set fields to one of the states is either by using an assignment with one of the special values or by reading data from a database that supports special values. SQL databases often support fields in the NULL state.

Go to: Top : Next page