Subset (attribute of property)

From JRapid

Jump to: navigation, search

subset is an attribute of property.


Contents

Description

The subset attribute is specified for entity-type properties to restrict the values that are available for selection in the corresponding widget or control.

The subset attribute specifies the name of the subset element as defined in the target entity.

The subsetparams specifies the parameters as a semicolon separated list. Each parameter is an FPath valid expression.

When a property of an existing record holds a value that no longer meets the conditions to be shown with the specified subset, the whennotinsubset attribute may be used to define the action to take.

Usage

<property
          entity = NAME
          subset = SUBSET
          subsetparams = SEMICOLON_SEPARATED_PARAMS
          whennotinsubset = "donotshow | show | shownotvalid"
          ... 
/>


Example

This example uses a subset for the State property in the Address entity to display only the states that belong to a certain country:

The State entity defines a subset element that returns the states for a given country.

<entity label="State" name="State">
        <subset name="subsetForCountry">
            <param entity="Country" name="countryParam"/>
            <condition field="country" value="countryParam"/>
        </subset>
        <property display="primary" label="Name" name="name" type="string"/>
        <property display="secondary" entity="Country" label="Country" name="country"/>
</entity>

<entity label="Country" name="Country">
        <property label="Name" name="name" display="primary" />
</entity>

<entity label="Address" name="Address">
        <property label="Street" name="street" display="primary" />
        <property label="Zip Code" name="zipCode" />
        <property entity="Country" label="Country" name="country"/>
        <property entity="State" label="State" name="state" subset="subsetForCountry" 
                subsetparams="country" whennotinsubset="donotshow"/>
</entity>
States for USA States for Argentina

The whennotinsubset attribute is set to "donotshow". If an existing address in California, USA, is edited and the country property is changed to a different value, then the value that was selected for the state property is not shown. The next picture shows the address as saved in the database on the left. On the right is the form with the country value changed to Argentina, and the state property value not being shown.

Subset with whennotinsubset attribute set to donotshow

See also

Personal tools