The IS operator
SYNTAX:
rel_op_extended = rel_op | IN | LIKE | IS .
The EDMexpressX defines the IS operator. It is used to determine if a particular instance is of a specific type. The IS operator returns a Boolean value.
When an instance can be one of many types, the IS operator has to be used for these possible types until TRUE is returned.
A more efficient way to determine the type of an instance, is to make use of the built-in function xpxGetInstanceType followed by a CASE statement:
Example using IS operator:
IF (attr.anInstance IS t:target::Ent1) THEN
. . .
ELSE
IF (attr.anInstance IS (t:target::Ent2) THEN
. . .
ELSE
IF (attr.anInstance IS (t:target::Ent3) THEN
. . .
ELSE
. . .
END_IF;
END_IF;
END_IF;
Example using xpxGetInstanceType function:
LOCAL
instType : GENERIC;
status : INTEGER;
. . .
END_LOCAL;
status := xpxGetInstanceType(attr.anInstance, instType);
IF (instType <> 0) THEN
CASE instType OF
target::Ent1 : . . .
target::Ent2 : . . .
target::Ent3 : . . .
. . .
otherwise: . . .
END_CASE;
END_IF;
. . .