Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

<select1 ref="/data/state">
<label ref="jr:itext('state-label')" />
<itemset nodeset="instance('locations')/states/state">
<label ref="name"/>
<value ref="id@id" />
</itemset>
</select1>

You can drill down to any level of location within this hierarchy by following this model.  For example, if your hierarchy starts at the regional level, then proceeds to state, then district, then facilityoutlet.  You can reference facilities like this:

<select1 ref="/data/outlet">
<label ref="jr:itext('outlet-label')" />
<itemset nodeset="instance('locations')/states/state/districts/district/outlets/outlet">
<label ref="name"/>
<value ref= "@id" />
</itemset>
</select1>

If you'd like to select a location based on a previously selected location higher up in the location hierarchy, in this example select a facility only from a list of facilities that are in a district that you've already chosen, you can filter use the following XML:

<select1 ref="/data/district">
<label ref="jr:itext('district-label')" />
<itemset nodeset="instance('locations')/states/state/districts/district">
<label ref="name"/>
<value ref= "@id" />
</itemset>
</select1>
<select1 ref="/data/outlet">
<label ref="jr:itext('outlet-label')" />
<itemset nodeset="instance('locations')/states/state/districts/district[@id = /data/district]/outlets/outlet">
<label ref="name"/>
<value ref= "
id
@id" />
</itemset>
</select1>

 

Note that whenever referencing the location hierarchy, only locations with which a mobile user is associated, so if the mobile user account is linked to outlet 'a', then the only district that will appear on that users phone is the district to which outlet 'a' belongs, and the only state will be the state to which that district belongs.