Contains (attribute of condition)

From JRapid

(Redirected from Contains)
Jump to: navigation, search

The "contains" attribute is used to create conditions which evaluates if a certain element is contained by a collection.

Usage

<condition 
    field = PROPERTY_TYPE_COLLECTION
    contains = ELEMENT
/>
  • field (required): the name of the property of type collection
  • contains: the element which should be contained or not

Example

The following Employee form displays the name of the Employee and an embeddedlisting of the companies in which he works.

The "forEmployee" Subset displays the companies for a certain Employee.

<entity label="Company" name="Company">
    ...
    <subset name="forEmployee">
        <param entity="Employee" name="employeeParam"/>
        <condition field="employees" contains="employeeParam" />
    </subset>
    <listing name="employeeCompanies" subset="forEmployee" />
    <property display="primary" label="Company" name="name" />
    <property collection="set" entity="Employee" label="Employees" name="employees"/>
    ...
</entity>   

The condition can be understand as the "employees contains employee".

<entity label="Employee" name="Employee">
    ...
    <property label="Name" name="name" type="string" />
    <embeddedlisting name="companies" entity="Company" listing="employeeCompanies" subset="forEmployee" subsetparams="." />
    ...
</entity>

The embeddedlisting element wraps the "employeeCompanies" listing. The subsetparams value is '.' which is resolved as the id of the employee.

See also

Personal tools