|
An ordering definition defines the order in which search results are shown. Each ordering definition is assigned a user-visible name, such as 'By Name', 'By DOB', etc., and which appears in the ordering pull-down selector in search results pages. By selecting an entry from this list, the user can control the order in which records are listed.
Multiple ordering definitions can (and usually are) defined for each table suffix. You can also add your own custom ordering definitions by calling pdsSetOrderingDef() (or, pdsSetAuxOrderingDef() for a user-defined record type) within your setup script.
The definition is given as a string containing name=value entries, separated by semicolons, where each name may be any of the following:
| Name |
Description |
| label |
The user-visible name for this ordering definition, to go in the ordering selector. E.g. 'By Name', etc.
The label is optional; if you do not supply one, Pedserve will automatically construct one using the labels of the fields (below).
|
fields |
This defines the database fields upon which the search results are to be ordered. It is given as a comma-separated list of 'field terms'.
A field term has the syntax fieldname{:option} where fieldname is the literal field name, and each option is one of the following:
- desc-1 Sets descending order for this field.
- desc-0 Sets ascending order for this field (default).
Example:
fields=A_DOB:desc-1,A_NAME;
- this would order animals first in descending order of date of birth, then in ascending order of name.
You may use chained field names here; this is useful e.g. when adding the ordering definitions for a user-defined record type, because it lets you arrange for the search results (i.e., a list of user defined records) to be ordered according to field values of the animal records with which they are associated. E.g. if you have added show records as a user-defined record type with table suffix 'XSR', and your animal records include a field for the name of the breeder (called A_BREEDERNAME), you could define an ordering for the show records that will order them according to the name of the breeder, using an ordering definition of the form fields=XSR_AID.A_BREEDERNAME etc.
|
Here is some sample code that adds a new ordering definition for the animals table (table suffix 'A'):
&pdsSetOrderingDef('A_myordering', 'fields=A_DOB:desc-1,A_NAME;');
The name of the definition, 'A_myordering', must be a unique definition name, and must start with the table suffix of the table to which it applies, then followed by an underscore (i.e., the 'A_' bit).
|

Search Results Showing Ordering Selector
|
USEFUL LINKS:
EULA
Pedserve Editions
Sample City
Consultancy
Data Preparation
Installation
Regular Expressions
Similarity Searching
Configuration File
Setup Script
Stylesheet
Database Design
Hooks
Date/Time
User Defined Fields
User Defined Records
Display Fields Definitions
Ordering Fields Definitions
Highlighting
Page Layout
Field Definitions
Field Formatting
Shortcut Query Buttons
Plates
Command Buttons
Connecting to the Database
Warning Footer Message
|