If the feature type is linked with a table by a multiple link, for specifying a simple condition it is not enough just to indicate the relation which should be satisfied for the field of linked record. It is also necessary to specify how the situation should be interpreted when the present relation is satisfied for some linked records, and for other records linked with the same feature it is not satisfied. When the simple condition is defined, ObjectLand allows the user to specify if the relation should be satisfied for all linked records or it is enough if the condition was satisfied for one record at least. Apart from that, possibilities of building complex filters are considerably extended if one can use not only field values of individual records in simple conditions, but such “integral” characteristics as total value of the specified field of all records linked with the feature, average value of the field, minimal or maximal field value as well. All these possibilities can be used when specifying the simple condition using the appropriate relation variant.
There are seven variants of relations in ObjectLand.
ANY – in this variant simple condition is considered to be true if there is at least one linked record satisfying the specified relation. The condition is false if all the linked records either do not satisfy the relation or contain undefined values of the field being checked.
The variant ANY can be specified for any relations and any field types admissible for the specified relation.
EACH – this variant requires all the linked records to satisfy the specified condition. If there is at least one linked record for which the relation is false, the simple condition is considered to be false. If the field value is undefined for some (or all) linked records, and for the remaining records the specified relation is true then the simple condition is considered to be undefined.
The variant EACH can be specified for any relations except for the relation of existence of record and any field types admissible for the specified relation.
SUM – in this variant the specified relation is checked not for the field of an individual record, but for the sum of values of the specified field by all linked records. If the field has an empty value at least for one linked record, the simple condition is considered to be undefined.
The variant SUM can be specified for relations of comparison, intervals and diapasons and the record field should be of integer or real type.
AVERAGE – differs from the previous variant in the fact that the sum of values is divided into the number of linked records.
MINIMUM – in this variant the specified relation is checked for the minimal value of the indicated field among all linked records. If the field has an empty value at least for one linked record, the simple condition is considered to be undefined.
The variant MINIMUM can be specified for the relations of comparison, intervals and diapasons, the record field should be of integer or real type or of the type “Date”, “Time”, “Timestamp”.
MAXIMUM – differs from the previous variant in the fact that instead of minimum, maximum value of the indicated field among all linked records is used.
COUNT – in this variant the system calculates the quantity of records linked with the feature and checks the specified relation for the number expressing this quantity. Unlike all other variants, field values are not taken into account at all.
The variant COUNT can be specified for the relation of comparison, intervals and diapasons. The table field for this variant of relations is not specified. Integer operands (one operand in case of relations of comparison, two – for the relation of diapasons/intervals) serve for comparison with the calculated number of linked records.
In the case when there is no record linked with the feature, their number is considered to be equal to 0 (in other words, the specified relation is checked for the number of records 0). Thus, the variant COUNT gives true or false value of the simple condition in this case (as the relations of existence of record do), while the condition value is considered undefined for all other variants of relations.
Table 36-2 shows all possible variants of relations for different types of relations and types of fields of the linked table.
Relations | Field types | Variants | |
comparison, | integer, real | ANY MINIMUM SUM | EACH MAXIMUM AVERAGE |
date, time, timestamp | ANY | EACH MAXIMUM | |
string, Boolean | ANY | EACH | |
no | COUNT | ||
matching the pattern | date, time, timestamp, string | ANY | EACH |
existence of value | integer, real, date, time, timestamp, string, Boolean | ANY | EACH |
existence of record | no | ANY | |
Table 36-2. Variants of relations in filter simple conditions
It can be seen from the table that the only variant admissible for all types of relations and for any types of record fields is the variant ANY. This variant is accepted by the system by default if the user didn't choose some other variant.
In case of a unique link between feature type and a table the notion of relation variant is useless. It is evident that in case of unique linked record the variants ANY, EACH, SUM, AVERAGE, MINIMUM and MAXIMUM will always give the same results, and the variant COUNT can be replaced by the relation of existence of record in this case. In this connection, if a table with unique link is selected in the course of simple condition input, the field of selecting the variant is not present in the window pane.