Changes between Version 12 and Version 13 of S3/S3ResourceFilter
- Timestamp:
- 01/31/12 14:25:36 (13 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
S3/S3ResourceFilter
v12 v13 150 150 }}} 151 151 152 If your filter involves a component table, you may need to add the respective joins. This can be done simply by specifying the component alias in the add_filter call: 152 Joins which become necessary for filters will be added automatically as long as you use S3ResourceQuery instances with add_filter. 153 154 You can though also specify a standard web2py Query for add_filter, in which case you would have to specify the respective join manually. If you specify a component alias as "c" parameter, the join for this component would be added automatically. 153 155 154 156 {{{ 155 myfilter = S3QueryField("contact.value")== "dominic@nursix.org"156 resource.add_filter(myfilter, c="contact") # also adds the join for the "contact" component to the resource query157 myfilter = db.pr_contact.value == "dominic@nursix.org" 158 resource.add_filter(myfilter, c="contact") 157 159 }}} 158 160 159 For URL filters, this happens automatically.161 Note that S3ResourceQuery instances are resource-agnostic, so they can be re-used across resources (provided the same field selector applies in all of them). 160 162 161 Note that filters as such (i.e. S3ResourceQuery instances) are resource-agnostic, so they can be re-used across resources (provided the same field selector applies in all of them). 162 163 Filters for fields which are not defined in a resource will be ignored quietly when retrieving records from the resource. 163 S3ResourceQueries for fields which are not defined in a resource will be ignored quietly when retrieving records from the resource.