Changes between Version 15 and Version 16 of S3/S3Hierarchy


Ignore:
Timestamp:
05/27/14 12:26:58 (10 years ago)
Author:
Dominic König
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • S3/S3Hierarchy

    v15 v16  
    244244''(Description to follow)''
    245245
    246 == Hierarchical Query Operator __typeof ==
    247 
    248 The {{{__typeof}}} query operator can be used to filter by a type and all its sub-types in a hierarchical taxonomy.
    249 
    250 ''(Description to follow)''
     246== Hierarchical Query Operator typeof ==
     247
     248The {{{typeof}}} query operator can be used to filter by a type and all its sub-types in a hierarchical taxonomy.
     249
     250It can be used with a reference (or list:reference) to a hierarchical table:
     251{{{#!python
     252query = FS("site_facility_type.facility_type_id").typeof(4L)
     253}}}
     254
     255or with a field within the hierarchical table:
     256{{{#!python
     257query = FS("site_facility_type.facility_type_id.name").typeof("Hospital")
     258}}}
     259
     260For string fields within the hierarchical table, "*" can be used as wildcard:
     261{{{#!python
     262# Matches e.g. "Fuel Depot", "Goods Depot" etc, and all their subtypes
     263query = FS("site_facility_type.facility_type_id.name").typeof("*Depot")
     264}}}
     265
     266Multiple options can be specified as list:
     267{{{#!python
     268# Matches "Hospital", "*Depot" and all their subtypes
     269query = FS("site_facility_type.facility_type_id.name").typeof(["Hospital", "*Depot"])
     270}}}
     271
     272In URLs, the operator is specified as !__typeof like:
     273{{{
     274eden/org/facility?site_facility_type.facility_type_id.name__typeof=Hospital,*Depot
     275}}}
     276
     277Where {{{typeof}}} is used with a virtual field, or no hierarchy is configured for the target table, it falls back to {{{belongs}}} (or {{{contains}}} for list-types, respectively).