Use @STRNUM to convert a number into a string and specify the output format and padding.
Syntax
@STRNUM (field, {LEFT | LEFTSPACE | RIGHT | RIGHTZERO} [length])
fieldThe name of the source numeric field.
LEFTLeft justify, fill the rest of the target column with spaces
LEFTSPACELeft justify, fill the rest of the target column.
RIGHTRight justify, fill with spaces
RIGHTZERORight justify, fill the rest of the target column with zeros
lengthSpecifies the output length, when any of the options are used that specify padding (all but LEFT).
Example
If field NUM has the value 15 and the target column CHAR1 is a maximum of 5 characters, the following examples show the different types of results obtained with formatting options.
| Function statement | Results (- denotes a space) |
|---|---|
CHAR1 = @STRNUM (NUM, LEFT) |
15 |
CHAR1 = @STRNUM (NUM, LEFTSPACE) |
15--- |
CHAR1 = @STRNUM (NUM, RIGHTZERO) |
00015 |
CHAR1 = @STRNUM (NUM, RIGHT) |
---15 |
If an output length of 4 is specified in the preceding example, the following shows the different types of results.
| Function statement | Results (- denotes a space) |
|---|---|
CHAR1 = @STRNUM (NUM, LEFTSPACE, 4) |
15-- |
CHAR1 = @STRNUM (NUM, RIGHTZERO, 4) |
0015 |
CHAR1 = @STRNUM (NUM, RIGHT, 4) |
--15 |