Project

General

Profile

setattribute coercion

Added by Brendan DeTracey about 3 years ago

setattribute trims leading zeros from strings it detects are numbers i.e. string is coerced to a number. It is possible to override this? It may not be normal to want an attribute value of 00375, but clearly I am not narmol. :)


Replies (2)

RE: setattribute coercion - Added by Uwe Schulzweida about 3 years ago

Hi Brendan,

In the next CDO version 2.0 it will be possible to specify the type of the attribute. The type will be specified with a colon and a character. Here is the syntax:

[var_nm@]att_nm[:{s|d|i}]=[att_val]
Where s stands for string, d for double and i for integer.

cdo setattribute,var_nm@att_nm:s=00375 infile outfile
creates a string attribute att_nm="00375".
A prerelease for testing is available in the download area.

Cheers,
Uwe

    (1-2/2)