Adobe COLDFUSION 9 Manual page 34

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

Advertisement

DEVELOPING COLDFUSION 9 APPLICATIONS
The CFML Programming Language
Returns any
or
OUT
INOUT
Functions
Functions typically manipulate data and return a result. You can also create user-defined functions (UDFs), sometimes
referred to as custom functions.
Functions have the following general form:
functionName([argument1[, argument2]]...)
Some functions, such as the
arguments and can have additional optional arguments. All ColdFusion functions return a value. For example,
returns the value 3.
Round(3.14159)
Built-in functions
ColdFusion built-in functions perform a variety of tasks, including, but not limited to, the following:
• Creating and manipulating complex data variables, such as arrays, lists, and structures
• Creating and manipulating queries
• Creating, analyzing, manipulating, and formatting strings and date and time values
• Evaluating the values of dynamic data
• Determining the type of a variable value
• Converting data between formats
• Performing mathematical operations
• Getting system information and resources
For alphabetical and categorized lists of ColdFusion functions, see ColdFusion Functions in the CFML Reference.
You use built-in functions throughout ColdFusion pages. Built-in functions are frequently used in a
tag to prepare data for display or further use. For example, the following line displays today's date in the
cfoutput
format October 24, 2007:
<cfoutput>#DateFormat(Now(), "mmmm d, yyyy")#</cfoutput>
This code uses two nested functions. The
date and time. The
DateFormat
string representation.
Functions are also valuable in CFScript scripts. ColdFusion does not support ColdFusion tags in CFScript, so you must
use functions to access ColdFusion functionality in scripts.
Implicit Get and Set Functions
ColdFusion components support private properties with public setter and getter methods. This behavior supports
object-oriented programming by letting you hide component properties from direct access.
By default, properties that you specify by using the
methods that access the PropertyName property in the CFC variables scope.
getPropertyName
Use the following code, for example, to set and get the MyProp property of
myCFC.setMyProp(27);
theProp = myCFC.getMyProp();
variables set by the procedure.
function take no arguments. Other functions require one or more comma-separated
Now
function returns a ColdFusion date-time value representing the current
Now
function takes the value returned by the
<cfproperty>
Last updated 8/5/2010
function and converts it to the desired
Now
tag have implicit
setPropertyName
component:
myCFC
29
or
cfset
and

Advertisement

Table of Contents
loading

Table of Contents