Sun Identity Manager Deployment Reference

Logical Expressions

Use the following functions to perform logical operations within expressions. Most logical functions return 1 and 0 to indicate true or false. The exceptions are cmp, ncmp, and, and or.

and Function

Takes any number of arguments and returns zero if any argument values are logically false. If one child evaluates to false, the function does not evaluate subsequent children. If all arguments are logically true, the function returns the value of the last argument. Zero (<i>0</i> or <s>0</s>) and <null> are considered logically false.

Example 1

The following expression returns zero.

<and> <i>42</i> <s>cat</s> <i>null</i> </and>

Example 2

The following expression returns cat.

<and> <i>42</i> <s>cat</s> </and>

cmp Function

Compares two string values. You can use this function to sort a list of strings

The function returns:

Arguments are coerced to strings, if necessary.

Example 1

The following expression returns -1.

<cmp>
    <i>20</i>
    <i>100</i>
 </cmp>

Example 2

The following expression returns -16. This expression returns a number that indicates the difference between the letters r and b when presented in alphabetical order. Since there are 16 letters between the letters b and r, when bob is compared to ray, the value is -16. Alternatively, if r were compared to b, the value returned would be 16.

<cmp>
    <s>bob</s>
    <s>ray</s>
</cmp>

Example 3

The following expression returns 0 (zero).

<cmp>
    <s>daryl</s>
    <s>daryl</s>
 </cmp>

eq Function

Performs an equality test. The function can take multiple arguments, although typically it has only two. The data type of the first argument defines how the equality test is performed. If the first argument is of type:

This function returns:

0– statement is logically false

1– statement is logically true

Example

<eq> <ref>role</ref> <s>engineering</s> </eq>

gt Function

Takes two arguments.

This function returns:

Example

<gt>
    <ref>age</ref>
    <i>42</i>
 </gt>

gte Function

Takes two arguments.

This function returns:

Example

The following expression returns 1.

<gte>
   <i>10</i>
   <i>5</i>
</gte>

isFalse Function

Used when referencing Boolean values that are represented with the strings true and false rather than the number 0 and 1. Takes one argument.

This function returns:

Example

The following expression returns 1.

<isFalse>
   <s>false</s>
</isFalse>

isnull Function

Takes one argument.

This function returns:

Example 1

The following expression returns 1.

<isnull> <null/> </isnull>

Example 2

The following expression returns 0.

<isnull> <i>0</i> </isnull>

isTrue Function

Used when referencing Boolean values that are represented with the strings true and false rather than the number 0 and 1. Takes one argument.

This function returns:

Example

The following expression returns 0.

<isTrue>
   <s>false</s>
</isTrue>

lt Function

Takes two arguments.

This function returns:

Example 1

The following expression returns 0 (zero).

<lt>
   <i>10</i>
   <i>5</i>
 </lt>

Example 2

The following expression returns 1.

<lt>
   <i>5</i>
   <i>10</i>
 </lt>

lte Function

Takes two arguments.

This function returns:

Example

<lte>
    <ref>age</ref>
    <i>42</i>
 </lte>

ncmp Function

Performs case-insensitive comparison of two string values.

This function returns:

Arguments are coerced to strings, if necessary.

Example

The following expression returns 0.

<ncmp>
   <s>Daryl</s>
   <s>daryl</s>
</ncmp>

neq Function

Performs an inequality test. Its behavior is simply the negation of the equality test performed by the eq function.

This function returns:

Example

<neq>
    <ref>role</ref>
    <s>management</s>
 </neq>

not Function

Reverses the logic of the nested expression.

This function returns:

Example

The following example returns 1.

<not> <eq> <i>42</i> <i>24</i> </eq> </not>

or Function

Takes multiple arguments.

This function returns:

0– all arguments are logically false

Value of the first argument expression that results in a logically true value

Example 1

The following expression returns 0, which is logically false.

<or> <i>0</i> <i>0</i> </or>

Example 2

The following expression returns the string cat, which is also logically true.

<or> <i>0</i> <s>cat</s> </or>

notnull Function

Takes one argument

This function returns:

0– null argument

1– non-null argument

Example 1

The value of the following expression is 1 if the firstname has been set or 0 (zero) if firstname is null.

<notnull>
   <ref>firstname</ref>
</notnull>

Example 2

The value of the following expression is 0 because the value is null.

<notnull><null/></notnull>