Datasheet
RAIS 3.0 Programmer’s Guide – Part I : Advanced Customization
19
2.3.1.2 Duplicate generator serial number
Example 1 was really simple. Let’s have a look at something more challenging: implement a
consistency check warning about duplicate serial numbers. Serial numbers are optional only
within RAIS 3.0. They hence may not be unique, as this would allow for only one generator
with unknown serial number to be entered in the whole database. So, as uniqueness is not
enforced, it is possible to enter twice the same serial number.
Let’s come quickly back to the query in example 1. Its design is simple, but has one
disadvantage: we may not test it by simply executing it and looking at its result set. This is
due to the fact that we use the field [COMBO Type] directly, which works fine when the
query is executed by the RAIS Interface. It does not work when we want to execute the query
in parallel to a running RAIS Interface, without saving the record. If we are in the unfortunate
situation to face a more complicated consistency check, we definitely want to preview the
result set for debugging purpose. In section 2.6, we introduce custom functions to easily
access control elements in the RAIS Interface, called Interface Access Functions. We will use
those Interface Access Functions in the next consistency check, so be sure that you have
implemented those functions as described in that section 2.6. Then, try this query:
Save it as [Consistency Check – Generator Duplicate Serial Number – Step 1]. Open the
RAIS Interface and enter a new generator. Run and analyze the query, meanwhile changing
the field [Serial Number] (please always assure that you have pressed enter after modifying
the field [Serial Number]). After running the query, you will realize that you do not need to
save the generator record any more for seeing the query results.
The query checks the table of generators and returns all records that match the serial number
we are about to enter for our new generator, i.e. above query returns conflicting records.
Remember the definition of consistency checks: they are successful if they return at least one
record. So what we want to have in fact is the complement of above query. Create this query:










