Page last modified 14:35, 10 Aug 2015 by juhako

=, <>, >=, <=, <, > (comparison)

    Description of the method

     

    Description:

    = and <> operators compare two values and are available for all types of elements

    = returns true if values are equal
    <> returns true if values are not equal

    Rest of the operators ( >=, <=, <, >) are available only for double/decimal and integer type of elements.

    >= returns true if left side operand is greater or equal to right side operand
    <= returns true if left side operand is less or equal to right side operand
    > returns true if left side operand is greater than right side operand
    < returns true if left side operand is less than right side operand

    Available for:

    = and <>: base64binary, boolean, datetime, double/decimal, date, hexBinary, integer, string

    >=, <=, <, >: double/decimal and integer

    Parameters: One paramater for comparison. Both operands of the comparison must have same type.
    Return type: boolean

    Example1

     

    Context: HeaderType1
    OCL: self.Id = "IdContent"
    Description: The example rule compares value of <Id> element to a string "IdContent".

     

    The XML snippet below would pass this check.

    <Id>IdContent</Id>

    The other snippet below however would not pass this check as the value is different from "IdContent".

    <Id>Id Content</Id>

     

    Example2

     

    Context: HeaderType1
    OCL: self.Id <> "IdContent"
    Description: The example rule compares value of <Id> element to a string "IdContent". The value is expected to be different from the string, otherwise an error will be returned by the rule.

     

    The XML snippet below would pass this check.

    <Id>SomeOtherContent</Id>

    The other snippet below however would not pass this check as the value is equal to "IdContent".

    <Id>IdContent</Id>

     

    Attached you can find example schema and files which you can use for testing.

    Menu