Description
NumericText tests to see if the content of a text object is a Number.
Action
NumericText tests to see if the content of a text object is a Number.
If the entire content of the field is a Number - or if the characters extracted via the
Subscript for arrays and strings are entirely a Number - the function returns a TRUE value.
If any part of the content of the field - or of the characters extracted - are not a Number, the function returns the value FALSE.
Typical uses
If you store numbers (like weight) in a text object, use NumericText to check the value of each record to make sure it is OK to convert using
ToNumber.
Examples
NumericText({file.REFERENCE})Returns FALSE where {file.REFERENCE} = "ABCDEFG".
NumericText({file.IDNUM})Returns TRUE where {file.IDNUM} = "12345".
NumericText({file.IDNUM})Returns TRUE where {file.IDNUM} = "12345443".
NumericText({file.IDNUM})Returns FALSE where {file.IDNUM} = "12345-443".
NumericText ({file.IDNUM} [1 to 5])Returns TRUE where {file.IDNUM} = "12345-443".
NumericText ({file.IDNUM} [6])Returns FALSE where {file.IDNUM} = "12345-443".
NumericText ({file.IDNUM} [7 to 9])Returns TRUE where {file.IDNUM} = "12345-443".
NumericText({file.IDNUM})Returns FALSE where {file.IDNUM} = "12345T".
Note: You can use this function in combination with
ToNumber to test for a Number in the Reference field, then print the string as a Number or print 0 if the text string is not a Number.
If NumericText({file.REFERENCE}) Then
ToNumber({file.REFERENCE})
Else
0;