|
A field definition is required for every field used within a Pedserve system. Each field definition gives the field name (as used within the database schema), and properties of the field such as its user-visible label, data type, and so on.
Pedserve provides field definitions for all the internal, pre-coded, fields that it uses. When you add new fields to the system, e.g. when you add user defined fields and/or user defined records, you must provide field definitions for every new field you add. You do this by calling the function &pdsSetFldDef (click here for an example). You can also modify existing field definitions - just use the function &pdsGetFldDef to return the current definition of a field, alter it, then re-set it using &pdsSetFldDef.
The field 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 display fields definition, to go in the display-fields selector. E.g. 'Basic Fields', etc.
|
type |
Specifies the field data type. Required. The following data types are supported:
str - Any kind of text field. The underlying database field could be VARCHAR, CHAR, TEXT etc.
flag - Used for boolean (logical) values. The underlying database field is expected to be CHAR(1) also should contain the value 'Y' or 'N'.
date - Date field. The underlying database field is expected to be DATE.
datetime - Datetime field. The underlying database field is expected to be DATETIME.
int - Any kind of integer field. The underlying database field could be INT, UNSIGNED INT, or any variation.
double - Floating point number field. The underlying database field is expected to be FLOAT.
key - Primary key field. Must be set on precisely one field within each table schema.
fkey - Foreign key field. Identifies a field that that holds a foreign key to another row (the target table being implied by the field name).
|
subtype |
Used to provide a 'sub-classification' of a field type. Optional. The following sub-types are supported:
sex - Used for the A_SEX field, to tell Pedserve that the field contains codings for the animal sex. Typically these codings should be 'M' or 'F'. And optionally, 'MN' or 'FN' for neuter forms. You can change these by changing the configuration variables $custom_strAnimalFieldSex_M, $custom_strAnimalFieldSex_F, etc. (see configuration file). When outputting the values of the sex field, Pedserve uses the configuration variables $custom_strTerm_MaleAnimal and $custom_strTerm_FemaleAnimal that you can change as appropriate e.g. 'Male'/'Dog'/'Stallion' etc.
count & value - Indicate whether an integer field (type=int) contains a value that is a 'count' of something, or a 'value' of something. This is used when Pedserve constructs the labels for field orderings; an integer field with subtype=count will be described as 'least first' or 'most first' rather than 'lowest first' or 'highest first' (which is more appropriate when an intfield is holding a value such as a height).
image - Used to indicate a text field contains an image filename. This triggers Pedserve's inbuilt image rendering and thumbnail support.
youngestoldest - Used to indicate a date field where an ascending ordering based on this field should be described as 'youngest first' (rather than 'newest first' or 'most recent first').
newoldest - Used to indicate a date field where an ascending ordering based on this field should be described as 'newest first' (rather than 'youngest first' or 'most recent first').
link - Used to indicate a text field whose value is a URL. When type subtype is given the field value will be rendered as a HTML link (i.e. as <a ...>value</a>). This feature is only present in Pedserve Pro, Advanced and Developer Editions.
|
label |
Gives the user-visible label for the field.
|
group |
Assigns a grouping to a field. This is just a name that is used by the internal plates to group together fields in the rendered output.
|
headingspanclass, headingthclass, valuespanclass & valuetdclass |
These are the names of CSS classes to be used in search results pages when displaying this field.
This feature is only present in Pedserve Pro, Advanced and Developer Editions.
headingthclass=cssname causes the <th> tag for the column heading to be assigned the given value as a class attribute (i.e. <th class='cssname' ...>). Typically you would use this to give a different background colour to the column heading.
headingspanclass=cssname causes the <span> tag for the column heading to be assigned the given value as a class attribute (i.e. <span class='cssname' ...>). Typically you would use this to give a different foreground colour or font to the column heading.
valuetdclass=cssname causes the <td> tag for the field cell to be assigned the given value as a class attribute (i.e. <td class='cssname' ...>). Typically you would use this to give a different background colour to the field values.
valuespanclass=cssname causes the <span> tag for the field cell to be assigned the given value as a class attribute (i.e. <span class='cssname' ...>). Typically you would use this to give a different foreground colour or font to the field values.
E.g. if you have a field definition for a field like this:
&pdsSetFldDef('XSR_SHOWNAME',
'type=str;label=Show Name;'
.'headingspanclass=myfg1;headingthclass=mybg1;'
.'valuespanclass=myfg2;valuetdclass=mybg2;');
... and your stylesheet contains this:
.mybg1 { background-color: #8cf; }
.myfg1 { color: #00f; }
.mybg2 { background-color: #cff; }
.myfg2 { color: #c43; }
... then you can get effects like this.
|
showas |
Used to control the formatted output for some field types. Optional. The following values are supported:
percent - Outputs a floating point field as a % value. The field is expected to contain a value between 0.0 & 1.0. Typical use is for the inbuilt inbreeding coefficient and relationship coefficient fields.
|
hidevalue |
Use this to cause a given value for the field to be hidden from display. A typical use of this is with an integer field where it is sometimes more appropriate to render a zero value for the field as nothing (i.e., empty) rather than output '0'. For such fields you might use hidevalue=0 in the field definition.
|
truncatewithellipsisafter |
Use this to cause a text field to be truncated when it is displayed in search results, if it is longer than a given no. of characters, with '...' appended. Useful for text fields that may hold very long values, and which you dont want to use too much space in the search results table. Sample.
This feature is only present in Pedserve Pro, Advanced and Developer Editions.
|
qopts |
Used to specify query options for a text field. Optional. The value is a combination of any of the following letters, in any order:
f - Specifies that the field provides full text searching options. It enables those options to be presented for the field in the advanced search screen. You must also make sure that such fields have a FULLTEXT index within the database.
s - Specifies that the field supports similarity searching. This is only supported by Pedserve Advanced and Developer Editions.
|
isdefaultqueryfield |
Specifies that this field should be the default (initially selected) field within the advanced search screen. Typically set for the A_NAME field etc.
|
naturalordering |
Use this to specify whether the default ordering for a field should be ascending (naturalordering=asc) or descending (naturalordering=desc). If not given, it is assumed to be ascending. E.g. this is set for the date of birth field, because when ordering animals by date of birth, it is often more useful to have them ordered with the most recent born first.
|
indexvalueatback |
Use this to specify a field value which should be considered to be 'after' all other field values. It can be useful to include indexvalueatback=; for text fields so that when the field is empty (or NULL), it is placed AFTER all other field values in an ordering.
|
notnull |
Used to specify when a field is declared as NOT NULL in the database table schema. This knowledge is used internally within Pedserve to optimize some operations. E.g. ordering by a field that is known to be not null can be faster than having to handle NULLs.
|
dbsize |
Used for text fields to specify the maximum length of the field in characters. E.g. used to control the maximum input that is allowed for a text field in form-filling pages such as the login application page.
|
inputrequired |
Used to say that the user MUST fill in this field in a form-filling page. E.g. when submitting a new pedigree, the name field must be given.
|
|

Search Results with Field Specific CSS Styles

Search Results with Field Ellipsis Truncation
|
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
|