Adobe COLDFUSION 9 Manual page 57

Developing applications
Hide thumbs Also See for COLDFUSION 9:
Table of Contents

Advertisement

DEVELOPING COLDFUSION 9 APPLICATIONS
The CFML Programming Language
ColdFusion processes expressions and functions in the following sequence:
1
For each operator in an expression, it determines the required operands. (For example, the multiplication operator
requires numeric operands and the CONTAINS operator requires string operands.)
For functions, it determines the type required for each function argument. (For example, the
two numbers as arguments and the
It evaluates all operands or function arguments.
2
3
It converts all operands or arguments whose types differ from the required type. If a conversion fails, it reports an
error.
Conversion between types
Although the expression evaluation mechanism in ColdFusion is powerful, it cannot automatically convert all data.
For example, the expression
to the number 8. Therefore, you must understand the rules for conversion between data types.
The following table explains how conversions are performed. The first column shows values to convert. The remaining
columns show the result of conversion to the listed data type.
Value
As Boolean
"Yes"
True
"No"
False
True
True
False
False
Number
True if Number is not 0;
False otherwise.
String
If "Yes", True
If "No", False
If it can be converted to 0,
False
If it can be converted to any
other number, True
Date
Error
ColdFusion cannot convert complex types, such as arrays, queries, and COM objects, to other types. However, it can
convert simple data elements of complex types to other simple data types.
Type conversion considerations
The following sections detail specific rules and considerations for converting between types.
function requires a string.)
Len
produces an error because ColdFusion cannot convert the string "eight"
"eight" * 10
As number
1
0
1
0
Number
If it represents a number (for
example, "1,000" or "12.36E-12"), it is
converted to the corresponding
number. If it represents a date-time
(see next column), it is converted to
the numeric value of the
corresponding date-time object.
The numeric value of the date-time
object.
Last updated 8/5/2010
Min
As date-time
As string
Error
"Yes"
Error
"No"
Error
"Yes"
Error
"No"
See "Date-time values" earlier in
String representation
this chapter.
of the number (for
example, "8").
If it is an ODBC date, time, or
String
timestamp (for example "{ts
'2001-06-14 11:30:13'}", or if it is
expressed in a standard U.S.
date or time format, including
the use of full or abbreviated
month names, it is converted to
the corresponding date-time
value.
Days of the week or unusual
punctuation result in an error.
Dashes, forward-slashes, and
spaces are generally allowed.
Date
An ODBC timestamp.
52
function requires

Advertisement

Table of Contents
loading

Table of Contents