Transforms

October 18th, 2014

Available in version 2.8. This functionality is an ALPHA version.

Transforms are functions applied to data to change it in some way in a short code. Short code processing proceeds like this:

  1. The database is queried
    1. unbuffered” and “random” are applied
  2. tfilter” or “tsearch” filters query results
  3. torderby” orders the results
  4. tlimit” limits the number of rows query
  5. trans” is applied for each listed transform in order
    1. Each transform can change values of fields, add or remove fields
    2. The results of each transform is the input for the next
  6. filter” or “search” is applied on the last transform results
    1. field names should refer to those in the transform results
  7. limit” is applied
  8. orderby” is applied
  9. show” and “hide” and short code-specific options are applied

Notes:

  • tfilter, tsearch, torderby, and tlimit work like filter, search, orderby and limit respectively
  • tfilter, tsearch, torderby, and tlimit happen before trans transforms are applied whereas filter, search, orderby and limit are applied after
  • tfilter, tsearch, torderby, and tlimit are ignored if there is no trans

Transform Examples

Transform Functions are

  • PHP functions used to change a single field such as trans=”name=strtoupper(name)” would re-assign the “name” field to be upper-cased. You could also assign a new field trans=”upper-name=strtoupper(name)”
    • Most PHP string-related functions (like “strtoupper”) can be used
    • You can create your own function and use it
  • PHP functions used to change the any part or all of the data set such as trans=”myfunction” where you define function myfunction($data) {}. $data is an associated array of file => value. The functions should return an associative array of the results.
  • PHP classes to change change the any part or all of the data set such trans=”NaturalSortByField(name)”.

Transforms can be changed together using &&. Example:

  • trans=”name=strtoupper(name)&&NaturalSortByField(name)

See more on Transform Functions and Transform Classes.

Comments are closed.  Go To Support Forum