selection

The selection element is the parent element for assignment operation elements, which are processed sequentially and used to assign a conditional value to the parent data group element. In effect, the selection element defines assignment operations that make up an if-then-else sequence of evaluations. If used, selection must be part of a valid advanced reference method that uses the appropriate reference operation attributes. If a ref element precedes the ref element that contains a selection element, the preceding ref value can be used to replace the initial value (i.e., operandLeft or operandLeftId) in the initial assignment operation of the selection element.

This element is:

To learn about how this element relates to other elements in a CygNet device template file, see Device Template File Hierarchy.

See also Reference Methods – Assign a Conditional Value (A, B, and C).

Example

Supporting Elements

The following table lists and describes special child elements used within a selection element and/or its container elements.

Element Description

sn

The sn elements inside a selection element define assignment operations.

sn elements must be numbered sequentially to define the order by which processing occurs. For example, s0, s1, sn means that s0 is processed first, then s1, and finally sn.

Each child element is evaluated in sequence from lowest number to highest. If a relational expression in a child element is true, the assign value of that element is assigned to that element, processing stops, and the assigned value is returned for the parent data group element.

defVal

defVal defines a default value to be automatically returned in the event that certain conditions are not met in a container element.

Currently, defVal is used in two situations. The first situation is when an enumeration requested by a referencing data group element, eFMS, or eGMR element does not match what is requested. The second situation is when no conditions defined in a selection element are met.

expr

expr defines an expression element where expr first defines the kind of relational operation to take place, then includes child elements that define the right and left operands in the operation. The expr value can then be compared to one or more other expr values.

operandLeft

operandLeft defines the constant value to be used to the left of a relational operator in a relational expression.

This element can be used as an attribute. See below.

operandLeftId

operandLeftId defines the data group element value to be used to the left of a relational operator in a relational expression.

This element can be used as an attribute. See below.

operandRight

operandRight defines the constant value to be used to the right of a relational operator in a relational expression.

This element can be used as an attribute. See below.

operandRightId

operandRightId defines the data group element value to be used to the right of a relational operator in a relational expression.

This element can be used as an attribute. See below.

Attributes

The following table lists and describes attributes generally applicable to this element. However, not all of the attributes listed here are applicable to all EIEs. Additionally, some attributes are required for use in every device template file of a certain EIE, but others may be used on a case-by-case or device-by-device basis, depending on your specific needs. All attributes in templates are case sensitive; but the case sensitivity of attribute values is based on context.

Note: Occasionally, device template files for different EIEs use attributes of the same name that do different things. Efforts are made in this document to highlight cases where an attribute by one name does different things in different EIEs.

Attribute Description

andOr

andOr defines the conjunction used between statements and/or expressions.

Value:
  • Only AND or OR are valid values. AND indicates that all conditions must be met; OR indicates that any one condition must be met.
  • If andOr is not used in the relevant context, the default value is AND.

assign

assign sets a constant value for a given expression if the expression's conditions are met.

Value:
  • User-defined string. However, the data group of which this attribute is a part will attempt to convert the user-defined string if the string is assigned for the data group and if the data group specifies a data type for its child elements.

assignId

assignId sets a data group element ID value for a given expression if the expression's conditions are met.

Value:
  • Must be a valid data group element ID.

bMsk

bMsk (bit mask) performs a bitwise AND operation on a referenced value when multiple bits are to be affected. bMsk cannot be used in the same element as bPos.

To make this attribute meter specific, append _ordn to the attribute. For example, bMsk_ord1.

Value:
  • Requires a positive whole number. Can be hex. If using hex, the hex number must start with 0x (i.e., 0xF, 0x0F, 0x00F, or 0x000F).
  • Must be greater than or equal to 1 (0x1 hex).
  • Must fit in a 32-bit field.
  • Default is unsigned bit shift, but may be overridden with bitShift to indicate whether to shift off the masked low bits.

See also Bit Mask Examples.

bPos

bPos (bit position) requests the binary value of the bit in the bit position specified. bPos cannot be used in the same element as bMsk.

To make this attribute meter specific, append _ordn to the attribute. For example, bPos_ord1.

Value:
  • Requires non-negative decimal or hex numbers only. If using hex, the hex number must start with 0x (i.e., 0xF, 0x0F, 0x00F, or 0x000F).
  • Must be greater than or equal to 0 (0x0 hex) and less than or equal to 31 (0x1F).
  • 0 - 7 are valid for an 8-bit field. 0 - 15 are valid for a 16-bit field. 0 - 31 are valid for a 32-bit field.
  • Always does an unsigned bit shift.

See also Bit Position Examples.

deid

deid specifies the data group element ID (DEID) of a referenced data group element from which to use a value.

eFMS and eGMR elements usually require deid. However, in special cases a register number (regNum) can be used instead of a deid value to associate a data item with a data source.

Value:
  • Any DEID of a valid source DataGroupElement element within the same data group as deid.
  • The deid value cannot be recursive; that is, it cannot reference the DataGroupElement element of which it is a part.
  • The source DataGroupElement element cannot itself be a reference DataGroupElement element.

See also ref and eFMS, eGMR.

op

op defines the use of a relational operator.

Value:
  • EQ: equal to
  • NE: not equal to
  • LT: less than
  • LE: less than or equal to
  • GT: greater than
  • GE: greater than or equal to
  • If an attribute value is not present, op defaults to EQ

operandLeft

operandLeft defines the constant value to be used to the left of a relational operator in a relational expression. For example, 3.13 in the expression 3.13 > 1 is the leftmost value.

Value:
  • Accepts different data types as values and converts them whenever possible.

This attribute can be used as an element. See above.

operandLeftId

operandLeftId defines the data group element ID value to be used to the left of a relational operator in a relational expression. For example, someData in the expression someData > 1 is the leftmost value.

Value:
  • Must be a valid data group element ID.

This attribute can be used as an element. See above.

operandRight

operandRight defines the constant value to be used to the right of a relational operator in a relational expression. For example, 3.13 in the expression 1 < 3.13 is the rightmost value.

Value:
  • Accepts different data types as values and converts them whenever possible.

This attribute can be used as an element. See above.

operandRightId

operandRightId defines the data group element ID value to be used to the right of a relational operator in a relational expression. For example, someData in the expression 1 < someData is the rightmost value.

Value:
  • Must be a valid data group element ID.

This attribute can be used as an element. See above.

value

value specifies a constant value. The value used must be relevant to the context in which value is used.

Value:
  • Depends on context. Often numeric, but may be string in the appropriate circumstance.

Back to top