Show TOC

CompoundExpression and ExpressionLocate this document in the navigation structure

Definition

Expression and CompoundExpression are used to build the view filters to apply on items or to define the item type criteria.

Attributes

Description

logicalOperation

This logicalOperation attribute specifies whether the logical operation between expressions in the compoundExpression is AND or OR .

referenceBundle

Text to be displayed in the filter selection dropdown box (only for Expressions within views)

defaultViewFilter

Flag to indicate this is the default filter to apply inside the view: yes or no (only for expressions within filters for views).

If there are filters defined for the view but none of them is marked as default filter, the UWL UI adds a blank entry to the filter dropdown box that allows to display all items in the view (no filter active).

Attributes

Description

name

Refers to a standard attribute or custom attribute of the item.

comparator

Specifies the comparator to use. Default is Equals. As specified in the DTD, the following values are possible: Equals, LessThan, LessThanOrEquals, GreaterThan, GreaterThanOrEquals, NotEquals, StartsWith, NotStartsWith, EndsWith, NotEndsWith, Contains, NotContains, ContainedBy

Note : Some of the comparators are not valid for certain data types. It is strongly recommended to use the following combinations only.

  • Date (for example dueDate)

    see below in the "value" section.

  • String (for example itemType)

    Following comparators are preferred.

    Equals,NotEquals,StartsWith,NotStartsWith,EndsWith,NotEndsWith,Contains, NotContains

    However following comparators are also supported. But these are complex comparisons and hence they do affect the performance.

    LessThan, LessaThanOrEquals,GreaterThan,GreaterThanOrEquals,ContainedBy

  • PriorityEnum

    Only following comparators are supported:

    Equals, GreaterThan,GreaterThanOrEquals,LessThan,LessThanOrEquals,NotEquals

  • StatusEnum

    Only Equals, NotEquals

value

Specifies the string value that will be converted to an appropriate data type, depending upon the attribute value type.

For Date types, the following values are supported: NextYear, ThisYear, LastYear, Next_3_Months, Last_3_Months, NextMonth, ThisMonth, LastMonth, NextWeek, ThisWeek, LastWeek, Today.

Note that these values define a range of time. Use comparator Equals to check against this range.

It is also possible to compare against fixed dates using the formats "yyyy.MM.dd" or ""yyyy.MM.dd hh:mm:ss a" or "yyyy.MM.dd hh:mm:ss".

Examples:

<Expression name="dueDate" comparator="Equals" value="NextWeek"/>

<Expression name="dueDate" comparator="LessThan" value="2004.12.31"/>

Example

The following examples illustrate how to build complex expressions.

In these example A, B, C, D are atomic units i.e. expressions. For example

expression A could be <Expression name="priority" comparator="Equals" value="high"/> and

expression B could be <Expression name="requestedDays" comparator="LessThan" value="3"/> etc.

  1. A and B and C

    <CompoundExpression operator="AND">
        <Expression A> <Expression B> <Expression C>
    </CompoundExpression>
    
                   
  2. (A and B) or C or D

    <CompoundExpression operator="OR">
            <CompoundExpression operator="AND">
                <Expression A> <Expression B>
            </CompoundExpression>
            <Expression C>
            <Expression D>
    </CompoundExpression>
    
                   

Example 2

The following snippet defines three filters in a view which displays all items, completed requests and only requests. All these filters appear in the dropdown list in the view for the user to choose.

<AllowedFilters>
    <CompoundExpression referenceBundle="filter_display_all" defaultViewFilter="yes">
    <Expression name="itemType" comparator="StartsWith" value="uwl" />
    </CompoundExpression>
  <CompoundExpression referenceBundle="filter_completed" >
       <Expression name="itemType" comparator="StartsWith" value="uwl.completedrequest" />
</CompoundExpression>
<CompoundExpression referenceBundle="filter_uncompleted">
   <Expression name="itemType" comparator="StartsWith" value="uwl.request" />
</CompoundExpression>
</AllowedFilters>