i5_field_scale

 

Gets field scale - number of digits for numeric fields.

 

int i5_field_scale (

resource result/file,
int/string field )

 

Details

 

For real type fields (packed or zoned), returns decimal places.

If field is integer, function returns 0.

If it's not a numeric type field, function returns –1.

 

Note:

Similar information may be found using i5_info function retrieving "ASDEC" key:

$info = i5_info($res, "NUMERIC");

echo "Number of decimals " . $info["ASDEC"];

 

Parameters

 

result

Resource describing file or other record set .

 

field

Integer or string identifying the field position or name.

 

 

Returns:

The number of digits of the field. If the field is not numeric, 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.

 

 

Example

 

 

$info = i5_info($res, "NUMERIC");

echo "Decimal place " . $info["ASDEC"];

$file = i5_open("EASYCOM/MATHS");

echo i5_field_scale($file, "TEXT"). "<BR>"; // -1

echo i5_field_scale($file, "INTEGER"). "<BR>"; // 0

echo i5_field_scale($file, "DEC10_2"). "<BR>"; // 2

 

 

See also

 

i5_fied_name

i5_field_len

i5_field_type

i5_info