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 Template File Hierarchy.
See also Reference Methods – Assign a Conditional Value (A, B, and C).
Example
|
<!-- The following example illustrates three distinct constructs (s0, s1, and s2) of the assignment operations that can make up a selection element. -->
<Select desc="Alarm State" readOnly="true" type="string" isRef="1"> <ref prec="0" refOp="opSelect"> <selection> <s0 assign="Low Alarm" operandLeftId="raw0" op="GT" operandRight="0"/> <s1 assignId="Medium Alarm" op="GT"> <operandLeft deid="raw0" bMsk="0x0F"/> <operandRight value="0"/> </s1> <s2 assign="High Alarm" andOr="and"> <expr op="GT"> <operandLeft deid="raw0" bPos="1"/> <operandRight value="0"/> </expr> <expr op="LT"> <operandLeft deid="raw1"/> <operandRight value="12"/> </expr> </s2> <defVal assign="No Alarms Found"/> </selection> </ref> </Select> |
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 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 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 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 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 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 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. |
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 defines the conjunction used between statements and/or expressions. Value:
|
|
|
assign sets a constant value for a given expression if the expression's conditions are met. Value:
|
|
|
assignId sets a data group element ID value for a given expression if the expression's conditions are met. Value:
|
|
|
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:
See also Bit Mask Examples. |
|
|
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:
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:
See also ref and eFMS, eGMR. |
|
op defines the use of a relational operator. Value:
|
|
|
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:
This attribute can be used as an element. See above. |
|
|
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:
This attribute can be used as an element. See above. |
|
|
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:
This attribute can be used as an element. See above. |
|
|
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:
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:
|