Condition (element)

From JRapid

Jump to: navigation, search

condition is an element, child of subset or filter.


Contents

Description

A condition over a property returns true or false by operating over the value of the property and another value. Conditions are used in subsets and filters to restrict results.

Attributes that apply to condition are:

  • field: The field on which to apply the operator, usually the name of a property.
  • an operator: value (eq), le, lt, ge, gt, etc.


Value attribute stands for the "equals" operator.


Available operators are:

  • value (eq): equals, =.
  • ne: not equals, !=.
  • lt: less than, <.
  • le: less or equals, <=.
  • gt: greater than, >.
  • ge: greater or equals, >=.
  • like: checks strings values.
  • isnull: checks if the value is null.
  • isnotnull: checks if the value is not null.
  • contains: checks if a collections contains a value.
  • in: checks if the value is in a collection.

Usage

<condition 
          field = FIELD
          value = VALUE
          in = COLLECTION
          contains = ITEM
          isnull= "isnull"
          gt = VALUE
          lt = VALUE
          ge = VALUE
          le = VALUE
          ne = VALUE
          like = PATTERN
/>


Example

  • Using a condition in a subset.

This subset which restrict all companies which are not a "companyParam" instance. When no operator is specified in a condition, the default "equals" is used.

<subset name="forCompanies">
    <param entity="Company" name="companyParam"/>
    <condition field="company" value="companyParam"/>
</subset>


  • Using a condition in a filter.
    <entity label="Company" menu="Menu" name="Company">
        <property display="primary" label="Name" name="name"/>
        <property display="secondary" label="Number Of Employees" name="numberOfEmp" type="integer"/>

        <filter display="primary" label="Number Of Employees" name="numberOfEmpFilter" type="integer">
            <condition field="numberOfEmp" ge="numberOfEmpFilter"/>
        </filter>
    </entity>

See also

Personal tools