View comments | RSS feed
Contents > Developing ColdFusion MX Applications > Using ColdFusion Variables > Data types PreviousNext

Data types

ColdFusion is often referred to as typeless because you do not assign types to variables and ColdFusion does not associate a type with the variable name. However, the data that a variable represents does have a type, and the data type affects how ColdFusion evaluates an expression or function argument. ColdFusion can automatically convert many data types into others when it evaluates expressions. For simple data, such as numbers and strings, the data type is unimportant until the variable is used in an expression or as a function argument.

ColdFusion variable data belongs to one of the following type categories:

Data type notes

Although ColdFusion variables do not have types, it is often convenient to use "variable type" as a shorthand for the type of data that the variable represents.

ColdFusion can validate the type of data contained in form fields and query parameters. For more information, see Validating form field data types and Using cfqueryparam.

The cfdump tag displays the entire contents of a variable, including ColdFusion complex data structures. It is an excellent tool for debugging complex data and the code that handles it.

ColdFusion provides the following functions for identifying the data type of a variable:

ColdFusion also includes the following functions for determining whether a string can be represented as another simple data type:

ColdFusion does not use a null data type. However, if ColdFusion receives a null value from an external source such as a database, a Java object, or some other mechanism, it maintains the null value until you use it as a simple value. At that time, ColdFusion converts the null to an empty string ("").


Contents > Developing ColdFusion MX Applications > Using ColdFusion Variables > Data types PreviousNext

ColdFusion 9 | ColdFusion 8 | ColdFusion MX 7 | ColdFusion MX 6.1 | ColdFusion MX | Forums | Developer Center | Bug Reporting

Version 6.1

Comments are no longer accepted for ColdFusion MX 6.1. ColdFusion 8 is the current version.

Comments


No screen name said on Aug 12, 2003 at 1:43 PM :
Null values are not converted to an empty string as the docs state. I am accessing a COM object that returns a Recordset. If the record has a field that has no value, and I display it, ColdFusion throws an exception. If I try to check the value with the expression "IS NOT NULL", an error is generated that says that the variable NULL is undefined....
jrunrandy said on Aug 13, 2003 at 5:28 AM :
This is a bug and has been assigned bug number 53243: When empty strings are passed to COM methods, the BSTR delivered to the object is a NULL pointer with 6.1. They were valid pointers to zero-length BSTRs in CFMX-Updater 3.
No screen name said on Aug 18, 2003 at 1:05 PM :
The same issue occurs when you try to access a null object returned from an web service.
Paresh Tyagi said on Apr 30, 2004 at 5:52 AM :
I think this is a very old problem (null). Coldfusion doesn't handle NULL properly. to an extent that you get an error that NULL is undefined.
manik_1 said on Jun 13, 2005 at 1:27 AM :
If my java variable returns NULL value, how do I capture in ColdFusion.
ASandstrom said on Jun 29, 2005 at 8:34 AM :
You may find the following article that discusses handling Java NULLs helpful:
http://www.macromedia.com/devnet/server_archive/articles/leveraging_java_classes_cf.html

 

RSS feed | Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/coldfusion/6.1/htmldocs/variabl5.htm