Multiple Dynamic Filters

A more sophistic way of filtering is supported by a Filter screen in the mobile app. This supports multiple filters, that optionally can be linked in a cascading order. E.g., if a mobile worker delivers items to a building, floor or room, it is possible to narrow the list according to any of these levels.

A filter criterion usually is an attribute of an XML element in the itemsPlanned's extra field. The names of the related attributes are specified in the filterNameParameterX process flow preferences (for X in [1…n]).

filterNameParameterX
Type Default Value Example Android HTML 5
String Undefined room + -

These filter criteria are referred to by XSL templates, which extract matching values from the items of the task. The templates are defined in the taskDetailFilterTemplateX process flow preferences (for X in [1…n]).

Note that, when a taskDetailFilterTemplate is defined, all itemsPlanned are displayed separately, no aggregation of similar itemsPlanned is done, as otherwise implied with the preference collectiveCriterion.

taskDetailFilterTemplateX
Type Default Value Example Android HTML 5
XML Undefined See below + -
<xml version="1.0" encoding="UTF-8">
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
       <xsl:param name="filterName1" />
       <xsl:output method="text" omit-xml-declaration="yes"                                          
       indent="no" />
       <xsl:template match="/">
          <xsl:choose>
              <xsl:when test="//@*[local-name() = $filterName1]">
                <xsl:value-of select="//@*[local-name() = $filterName1]" />
              </xsl:when>
          </xsl:choose>
       </xsl:template>
</xsl:stylesheet>

The values, extracted by the XSL template, are shown in the lists of the filter screen.

To define cascading filters, a template can include filter parameters and selected values of preceiding fiters:

<xml version="1.0" encoding="UTF-8">
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
     <xsl:param name="filterName1" />
     <xsl:param name="filterName2" />
     <xsl:param name="filter1" />
     <xsl:output method="text" omit-xml-declaration="yes" indent="no" />
     <xsl:template match="/">
          <xsl:choose>
               <xsl:when test="string-length($filter1)=0 or //@*[local-name() =  
                $filterName1] = $filter1">
                     <xsl:value-of select="//@*[local-name() = $filterName2]" />
               </xsl:when>
          </xsl:choose>
     </xsl:template>
</xsl:stylesheet>

The XSL template in the process flow preference itemsPlannedExtraFilteringTemplate defines, according to the selected filter criteria, if an item is filtered or not. This template can receive names of filter criteria and their values as parameters. If the template returns "true", when processing an item's extra field, then the item is displayed, else the item is not displayed.

itemsPlannedExtraFilteringTemplate
Type Default Value Example Android HTML 5
XML Undefined See below + -
<xml version="1.0" encoding="UTF-8">
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
       <xsl:param name="filterName1" />
       <xsl:param name="filterName2" />
       <xsl:param name="filterName3" />
       <xsl:param name="filterName4" />
       <xsl:param name="filter1" />
       <xsl:param name="filter2" />
       <xsl:param name="filter3" />
       <xsl:param name="filter4" />
       <xsl:output method="text" omit-xml-declaration="yes" indent="no" />
       <xsl:template match="/">
              <xsl:choose>
                     <xsl:when test=
        "(string-length($filter1)=0 or //@*[local-name() = $filterName1] = $filter1) 
     and (string-length($filter2)=0 or //@*[local-name() = $filterName2] = $filter2)
     and (string-length($filter3)=0 or //@*[local-name() = $filterName3] = $filter3)
     and (string-length($filter4)=0 or //@*[local-name() = $filterName4] = 
     $filter4)">
                           <xsl:value-of select="'true'" />
                      </xsl:when>
                      <xsl:otherwise>
                            <xsl:value-of select="'false'" />
                      </xsl:otherwise>
               </xsl:choose>
        </xsl:template>
</xsl:stylesheet>

By turning the preference itemsPlannedScanFilter on, a barcode icon appears in the menu which can be used to scan barcodes of devices on site. All planned items are checked if one of them contains the barcode in the extra field. If so, the Mobile UI of the that item is immediately opened.

itemsPlannedScanFilter
Type Default Value Example Android HTML 5
Boolean false true + -

results matching ""

    No results matching ""