Tech Tip: Convert Time Field into Text Format for SQL Data Results
PRODUCT: 4D | VERSION: 12.3 | PLATFORM: Mac & Win
Published On: January 31, 2012
This Technical Tip demonstrates how data from a time field can be populated into a text array since there is no time array in 4D.
The following method simply takes a parameter of type time and converts it into a string:
//Method Name: util_timeToText //Parameter(s): // $1 - time C_TIME($1;$time) C_TEXT($0) $time:=$1 $0:=String($time) |
The above method can be used in a SQL statement so that data from a time field can be populated into a text array as shown below:
ARRAY TEXT(timeArray;0) Begin SQL SELECT {FN util_timeToText(timeField) AS TEXT} FROM Table_1 INTO :timeArray End SQL |
Note: The method attribute "Available through SQL" must be enabled for the function being called in a SQL statement.