IBM BPM, V8.0.1, All platforms > Authoring services in Integration Designer > Developing monitor models > What are monitor models? > Expression support
Converting between Common Base Event primitive types and XML data types
When event attributes are used in expressions that accept input from inbound events or in expressions that populate outbound events, they are converted to XML schema data types. This conversion applies only to events based on Common Base Event definitions. XSD-based event part definitions have attributes and elements that are already defined using XSD types, so no conversion is necessary.
Event attributes used in events based on Common Base Event definitions must have one of the following nine primitive types: byte, short, int, long, float, double, string, dateTime, and boolean. These types are converted to XML schema data types when:
- Event attributes are read by maps taking input from inbound events
- Event attributes are written by maps populating outbound events
The following conversions are applied:
- byte <-> xs:integer
- short <–> xs:integer
- int <–> xs:integer
- long <–> xs:integer
- float <–> xs:decimal
- double <–> xs:decimal
- string <–> xs:string
- dateTime <–> xs:dateTime
- boolean <–> xs:boolean
Integers that are larger than the largest value that can be held in an event attribute of type byte, short, int, or long are right-truncated to the number of bits in the result (that is, if the value is too large to fit in the event attribute, the bits that do not fit are thrown away).
For example, if you map the integer 1000 to a (signed) byte attribute, only 8 bits are kept, which results in the number -24. Similarly, the integer 1024 is mapped to 0. If a value assigned to a metric is outside the range that is allowed for its type, the value will not be displayed correctly in the dashboards.
The following range of numbers can be held in an event attribute depending on its type:
Type Range of Numbers byte from –128 to 127, inclusive short from –32768 to 32767, inclusive int from –2147483648 to 2147483647, inclusive long from –9223372036854775808 to 9223372036854775807, inclusive If a value assigned to a metric is outside the range that is allowed for its type, the value will not be displayed correctly in the dashboards.
The XML schema data type duration has two totally ordered subtypes: yearMonthDuration and dayTimeDuration (see
http://www.w3.org/TR/xquery-operators/#duration-subtypes). Only dayTimeDuration values are currently supported for any attributes or expressions with a type of duration.
Many decimal numbers (for example 1.20, which is represented in binary as 1.001100110011 ... ) cannot be represented as a binary floating point number with a finite number of bits. Therefore, rounding errors are inevitable when decimal data is transferred using event attributes of type float or double. To avoid rounding errors, either convert decimal numbers to strings, or convert decimal numbers to large enough integers (such as longs) by multiplying by a power of 10 (10, 100, 1000, or whatever size you need to change the decimal into a whole number).