Gets field scale - number of decimal digits for numeric fields.
int i5_field_scale (resource result/file, int/string field)
Parameters
result |
Resource describing file or other record set.
|
field |
Integer or string identifying the field position or name.
|
Return
The number of decimal digits of the field. If the field is not numeric, returns 0.
In case of error, returns -1.
I5_ERR_PHP_HDLDFT |
256 |
No default connection found. |
I5_ERR_PHP_OPTIONSTYPE |
259 |
The type of " I5_OPTIONS_ALIAS" option must be x and not x |
I5_ERR_PHP_OPTIONSNUMBER |
260 |
Option number -1 is unknown. |
I5_ERR_PHP_TYPEPARAM |
262 |
Type of element x in parameter -1 must be y. Type z was provided. |
Details
For real type fields (packed or zoned), returns number of decimal digits.
If field is integer, function returns 0.
If it's not a numeric type field, function returns 0.
Note:
Similar information may be found using i5_info function retrieving "AsDec" key:
$info = i5_info($res, "NUMERIC");
echo "Number of decimals " . $info["AsDec"];
Example
$info = i5_info($res, "NUMERIC");
echo "Decimal place " . $info["AsDec"];
$file = i5_open("EASYCOM/MATHS");
echo i5_field_scale($file, "TEXT"). "<BR>"; // 0
echo i5_field_scale($file, "INTEGER"). "<BR>"; // 0
echo i5_field_scale($file, "DEC10_2"). "<BR>"; // 2
See also