Decimal field
EPrints 3 Reference: Directory Structure - Metadata Fields - Repository Configuration - XML Config Files - XML Export Format - EPrints data structure - Core API - Data Objects
Metadata Fields: Arclanguage - Base64 - Bigint - Boolean - Compound - Counter - Dataobjref - Date - Decimal - Email - Fields - Float - Id - Idci - Image - Int - Itemref - Keywords - Langid - Longtext - Longtext_counter - Multilang - Multipart - Name - Namedset - Pagerange - Recaptcha - Recaptcha3 - Relation - Search - Secret - Set - Storable - Subject - Subobject - Text - Time - Timestamp - Url - Uuid
Contents
Description
This field stores a decimal number. It could be used for prices or other numerical floating point numbers with a spefied amount of precision.
Inheritance
Additional Properties
As for Float fields except for:
Name | Default Value | Required | Description | Notes |
---|---|---|---|---|
integer | 16 | NO | The maximum number of digits to store before the decimal point. | |
fractional | 2 | NO | The number of digits to store after the decimal point. |
Required Phrases
No additional phrases beyond those required for Float fields.
Database
Float fields are stored in the database as
fieldname DECIMAL(16,2)
The 16 and 2 will vary depending on what is set for integer
and fractional
respectively.
API
See API page.
Examples
Most basic example.
{ name => 'total', type => 'decimal', }
Set smaller number of digits before the decimal point
{ name => 'price', type => 'decimal', integer => 8, }
Set larger number of digits after the decimal point.
{ name => 'latitude', type => 'decimal', fractional => 8, }