MACROMEDIA COLFUSION MX 7-CFML Reference - page 405
cfstoredproc
405
Usage
Use this tag to call a database stored procedure. Within this tag, you code
cfprocresult
and
cfprocparam
tags as follows:
•
cfprocresult
If the stored procedure returns one or more result sets, code one
cfprocresult
tag per result set.
•
cfprocparam
If the stored procedure uses input or output parameters, code one
cfprocparam
tag per parameter, ensuring that you include every parameter in the stored
procedure definition. Additionally, you must code
cfprocparam
tags in the same order as the
parameters in the stored procedure definition.
If you set
returnCode = "Yes"
, this tag sets the variable
prefix.statusCode
, which holds the
status code for a stored procedure. Status code values vary by DBMS. For the meaning of code
values, see your DBMS documentation.
This tag sets the variable
prefix.ExecutionTime
, which contains the execution time of the
stored procedure, in milliseconds.
The value of
prefix
is either
cfstoredproc
or the value specified by the
result
attribute, if it is
set. The
result
attribute provides a way for stored procedures that are called from multiple
pages, possibly at the same time, to avoid overwriting the results of one call with another. If you
set the
result
attribute to
myResult
, for example, you would access
ExecutionTime
as
myResult.ExecutionTime
. Otherwise, you would access it as
cfstoredproc.ExecutionTime.
Before implementing this tag, ensure that you understand stored procedures and their usage.
The following examples use a Sybase stored procedure; for an example of an Oracle 8 or 9 stored
procedure, see
cfprocparam
.
Example
.
Page 376
376 chapter 2: coldfusion tags cfscript description encloses a code block that contains cfscript statements. Category application framework tags , other tags syntax cfscript code here see also cfinvoke , cfmodule , createobject ; chapter 6, “extending coldfusion pages with cfml scripting” in coldfus...
Page 377
Cfscript 377 you cannot use the elseif construct within a cfscript tag. You can use code such as the following: else if ( condition ) { ... } exception handling with the cfscript tag to handle exceptions with this tag, use try and catch statements, which are equivalent to the cftry and cfcatch tags....
Page 378
378 chapter 2: coldfusion tags consuming web services with the cfscript tag the following example shows how to consume a web service with the cfscript tag. You use the createobject function to connect to the web service. Ws = createobject("webservice", "http://www.Xmethods.Net/sd/2001/babelfishservi...
Page 379: Chapter 2
Cfsearch 379 cfsearch description searches one or more verity collections. A collection must be created and indexed before this tag can return search results. A collection can be created in these ways: • with the cfcollection tag • in the coldfusion mx administrator • using a native verity indexing ...
Page 380
380 chapter 2: coldfusion tags see also cfcollection , cfexecute , cfindex , cfobject , cfreport , cfwddx history coldfusion mx 7: • added category , categorytree , status , suggestions , contextpassages , contextbytes , contexthighlightbegin , contexthighlightend , and previouscriteria attributes. ...
Page 381
Cfsearch 381 category optional a list of categories, separated by commas, to which the search is limited. If specified, and the collection does not have categories enabled, coldfusion throws an exception. Categorytree optional the location in a hierarchical category tree at which to start the search...
Page 382
382 chapter 2: coldfusion tags usage the cfsearch tag returns a query object whose columns you can reference in a cfoutput tag. For example, the following code specifies a search for the exact terms "filming" or "filmed": name = "mysearch" collection = "mycollection" criteria = '`film{ing,ed}`' type...
Page 383
Cfsearch 383 in this example, the single-quotation mark ( ' ) and backtick ( ` ) characters are used as delimiters; for more information, see chapter 25, “using verity search expressions” in coldfusion mx developer’s guide. To optimize search performance, always specify the maxrows attribute, settin...
Page 384
384 chapter 2: coldfusion tags status structure keys to permit application users to search verity collections for nonstandard strings, words, or characters (for example, "ab23.45.67" or "--->") that would otherwise cause an error, you can create a text file that lists these elements and defines thei...
Page 385
Cfsearch 385 title=#name.Title# score=#name.Score# custom1=#name.Custom1# custom2=#name.Custom2# summary=#name.Summary# recordcount=#name.Recordcount# currentrow=#name.Currentrow# columnlist=#name.Columnlist# recordssearched=#name.Recordssearched# name = "snippets" collection = "snippets" criteria =...
Page 386
386 chapter 2: coldfusion tags currentrow=#book.Currentrow# columnlist=#book.Columnlist# recordssearched=#book.Recordssearched#.
Page 387
Cfselect 387 cfselect description constructs a drop-down list box form control. Used within a cfform tag. You can populate the list from a query, or by using the html option tag. Category forms tags syntax name = "name" label = "label" style = "style specification" size = "integer" required = "yes" ...
Page 388
388 chapter 2: coldfusion tags • added on -prefixed attributes. • added enabled , group , height , label , queryposition , tooltip , visible , and width attributes. Attributes the following table lists attributes that coldfusion uses directly. The tag also supports all html select tag attributes tha...
Page 389
Cfselect 389 display optional; all value of value attribute query column to use for the display label of each list element. Used with the query attribute. Group optional; html and xml query column to use to group the items in the drop-down list into a two-level hierarchical list. Queryposition optio...
Page 390
390 chapter 2: coldfusion tags note: attributes that are marked as flash only are not handled by the skins provided with coldfusion mx. They are, however, included in the generated xml. Usage this tag requires an end tag and can include html option and optgroup child tags. To ensure that a selected ...
Page 391
Cfselect 391 show the selected names. ---> #name# email: #email# select emp_id, email, phone, department, firstname, lastname, firstname +' ' +lastname as name from getallemployees where emp_id in (#form.Employeeid#) #firstname# #lastname# email: #email# name = "employeeid" size = "15" multiple="yes...
Page 392
392 chapter 2: coldfusion tags cfservlet description this tag is deprecated. Executes a java servlet on a jrun engine. To access servlets that run on the same server as coldfusion, use code such as the following, in which path specifies a servlet, jsp, or anything else: getpagecontext().Include(path...
Page 393
Cfservletparam 393 cfservletparam description this tag is deprecated. A child tag of the cfservlet tag. Passes data to a servlet. Each cfservletparam tag within the cfservlet block passes a separate item of data to the servlet. To access servlets that run on the same server as coldfusion, use code s...
Page 394
394 chapter 2: coldfusion tags cfset description sets a value in coldfusion. Used to create a variable, if it does not exist, and assign it a value. Also used to call functions. Category variable manipulation tags syntax var variable_name = expression > see also cfcookie , cfparam , cfregistry , cfs...
Page 395
Cfset 395 dynamic variable names in this example, the variable name is itself a variable: function local variables the var keyword specifies that the variable being defined is only available inside the body of a function that you define using the cffunction tag. The variable value that is set in one...
Page 396
396 chapter 2: coldfusion tags example select * from messages cfset sets and reassigns values to local or global variables within a page. For example, the variable numrecords has been declared on this page to hold the number of records returned from query (#numrecords#). In addition, cfset can be us...
Page 397
Cfsetting 397 cfsetting description controls aspects of page processing, such as the output of html code in pages. Category page processing tags , variable manipulation tags syntax enablecfoutputonly = "yes" or "no" showdebugoutput = "yes" or "no" requesttimeout = "value in seconds" > see also cfcac...
Page 398
398 chapter 2: coldfusion tags usage the cfsetting requesttimeout attribute replaces the use of requesttimeout within a url. To enforce a page timeout, detect the url variable and use code such as the following to change the page timeout: you can use this tag to manage whitespace in coldfusion outpu...
Page 399
Cfsilent 399 cfsilent description suppresses output produced by cfml within a tag’s scope. Category data output tags , page processing tags syntax ... See also cfcache , cfflush , cfheader , cfhtmlhead , cfinclude , cfsetting ; chapter 9, “writing and calling user-defined functions,” in coldfusion m...
Page 400
400 chapter 2: coldfusion tags cfslider description puts a slider control, for selecting a numeric value from a range, in a coldfusion form. The slider moves over the slider groove. As the user moves the slider, the current value displays. Used within a cfform tag. Not supported with flash forms. Ca...
Page 401
Cfslider 401 attributes attribute req/opt default description name required name of cfslider control. Label optional label to display with control; for example, "volume" this displays: "volume %value%" to reference the value, use "%value%" . If %% is omitted, slider value displays directly after lab...
Page 402
402 chapter 2: coldfusion tags usage this tag requires the client to download a java applet. Using this tag may be slightly slower than using an html form element to display the same information. Also, if the client does not have an up-to-date java plugin installed, the system might also have to dow...
Page 403
Cfslider 403 if the following conditions are true, a user’s selection from query data that populates this tag’s options continues to display after the user submits the form: • the cfform preservedata attribute is set to " yes ". • the cfform action attribute posts to the same page as the form itself...
Page 404
404 chapter 2: coldfusion tags cfstoredproc description executes a stored procedure in a server database. It specifies database connection information and identifies the stored procedure. Category database manipulation tags syntax procedure = "procedure name" datasource = "ds_name" username = "usern...
Page 405
Cfstoredproc 405 usage use this tag to call a database stored procedure. Within this tag, you code cfprocresult and cfprocparam tags as follows: • cfprocresult if the stored procedure returns one or more result sets, code one cfprocresult tag per result set. • cfprocparam if the stored procedure use...
Page 406
406 chapter 2: coldfusion tags value = "1" dbvarname = @param1> variable = foo dbvarname = @param2> ---> value = "1" dbvarname = @param1> variable = foo dbvarname = @param2> ---> variable = foo dbvarname = @param2> --->.
Page 407
Cfswitch 407 cfswitch description evaluates a passed expression and passes control to the cfcase tag that matches the expression result. You can, optionally, code a cfdefaultcase tag, which receives control if there is no matching cfcase tag value. Category flow-control tags syntax expression = "exp...
Page 408
408 chapter 2: coldfusion tags example select emp_id, firstname, lastname, email, phone, department from employees each time the case is fulfilled, the specific information is printed; if the case is not fulfilled, the default case is output #firstname# #lastname# is in sales #firstname# #lastname# ...
Page 409
Cftable 409 cftable description builds a table in a coldfusion page. This tag renders data as preformatted text, or, with the htmltable attribute, in an html table. If you don't want to write html table tag code, or if your data can be presented as preformatted text, use this tag. Preformatted text ...
Page 410
410 chapter 2: coldfusion tags usage this tag aligns table data, sets column widths, and defines column heads. At least one cfcol tag is required within this tag. You must put cfcol and cftable tags adjacent in a page. The only tag that you can nest within this tag is the cfcol tag. You cannot nest ...
Page 411
Cftable 411.
Page 412
412 chapter 2: coldfusion tags cftextarea description puts a multiline text entry box in a cfform tag and controls its display characteristics. Category forms tags syntax name = "name" label = "text" required = "yes" or "no" style = "style specification" validate = "data type" validateat= one or mor...
Page 413
Cftextarea 413 note: attributes that are marked as flash only are not handled by the skins provided with coldfusion mx. They are, however, included in the generated xml. Attribute req/opt; format default description name required; all name of the cftextinput control. Label optional; flash and xml la...
Page 414
414 chapter 2: coldfusion tags pattern required if validate = "regular_ expression" html and xml. Javascript regular expression pattern to validate input. Omit leading and trailing slashes. Coldfusion uses this attribute only if you specify regex in the validate attribute. For examples and syntax, s...
Page 415
Cftextarea 415 note: attributes that are marked as flash only are not handled by the skins provided with coldfusion mx. They are, however, included in the generated xml. Usage for this tag to work properly in html format. The browser must be javascript-enabled. If you put text in the tag body, the c...
Page 416
416 chapter 2: coldfusion tags bind="hello {username.Text}! Enter your comments here." /> example this example has two cftextarea controls. When you submit the form, coldfusion copies the text from the first control into the second. The onblur maxlength validation prevents you from entering more tha...
Page 417
Cftextinput 417 cftextinput description puts a single-line text entry box in a cfform tag and controls its display characteristics. This tag is deprecated, and is not supported in xml format forms. In its place, you should use a cfinput or cftextarea tag and use a cascading style sheet (css) to spec...
Page 418
418 chapter 2: coldfusion tags cfthrow description throws a developer-specified exception, which can be caught with a cfcatch tag that has any of the following type attribute options: • type = "custom_type" • type = "application" • type = "any" category exception handling tags , flow-control tags sy...
Page 419
Cfthrow 419 usage use this tag within a cftry block, to throw an error. The cfcatch block can access accompanying information, as follows: • message, with cfcatch.Message • detail, with cfcatch.Detail • error code, with cfcatch.Errorcode to get more information, use cfcatch.Tagcontext . This array s...
Page 420
420 chapter 2: coldfusion tags #cfcatch.Message# the contents of the tag stack are: index = i from = 1 to = #arraylen(cfcatch.Tagcontext)#> #i# #scurrent["id"]# (#scurrent["line"]#,#scurrent["column"]#) #scurrent["template"]# index = i from = 1 to = #arraylen(cfcatch.Tagcontext)#> #i# #scurrent["id"...
Page 421
Cftimer 421 cftimer description displays execution time for a specified section of cfml code. Coldfusion mx displays the timing information along with any output produced by the timed code. Note: to permit this tag to execute, you must enable the timer information option under debugging settings in ...
Page 422
422 chapter 2: coldfusion tags example1 ... Select * from employees #lastname#, #firstname# select * from courselist select * from parks select view > source to see timing information select *.
Page 423
Cftimer 423 from departments scroll down to cftimer times heading to see timing information ....
Page 424
424 chapter 2: coldfusion tags cftrace description displays and logs debugging data about the state of an application at the time the cftrace tag executes. Tracks runtime logic flow, variable values, and execution time. Displays output at the end of the request or in the debugging section at the end...
Page 425
Cftrace 425 usage you cannot put application code within this tag. (this avoids problems that can occur if you disable debugging.) this tag is useful for debugging cfml code during application development. You can display cftrace tag output in the following ways: • as a section in the debugging outp...
Page 426
426 chapter 2: coldfusion tags cftransaction description for enterprise database management systems that support transaction processing, instructs the database management system to treat multiple database operations as a single transaction. Provides database commit and rollback processing. See the d...
Page 427
Cftransaction 427 usage if you do not specify a value for the action attribute, automatic transaction processing proceeds as follows: • if the cfquery operations within the transaction block complete without an error, the transaction is committed. • if a cfquery tag generates an error within a cftra...
Page 428
428 chapter 2: coldfusion tags cftree description inserts a tree control in a form. Validates user selections. Used within a cfform tag block. You can use a coldfusion query to supply data to the tree. Category forms tags syntax format="applet", "flash", xml, or "object" required = "yes" or "no" del...
Page 429
Cftree 429 history coldfusion mx 7: • added the format attribute and support for generating flash and xml and object output. • added enabled , onchange , style , tooltip , and visible attributes (flash format only). Coldfusion mx: changed behavior: coldfusion renders a tree control regardless of whe...
Page 430
430 chapter 2: coldfusion tags appendkey optional; all yes • yes: if you use cftreeitem href attributes, coldfusion appends a cftreeitemkey query string variable with the value of the selected tree item to the cfform action url. • no: does not append the tree item value to the url. Highlighthref opt...
Page 431
Cftree 431 align optional; applet, object • top • left • bottom • baseline • texttop • absbottom • middle • absmiddle • right border optional; applet, object yes • yes: displays a border around the tree control. • no hscroll optional; applet, object yes • yes: permits horizontal scrolling. • no vscr...
Page 432
432 chapter 2: coldfusion tags note: all attributes are passed to the xml generated in xml format, but no coldfusion mx skin interprets cftree xml. Usage this tag must be in a cfform tag block. The applet format tree requires the client to download a java applet. Also, if the client does not have an...
Page 433
Cftree 433 the structure variable name is specified by the cftree name attribute. The top level of the structure has two types of entries: • attribute settings • a children array attribute settings the structure has top-level entries with the values of the following cftree attributes: children array...
Page 434
434 chapter 2: coldfusion tags from courselist c, departments d where d.Dept_id = c.Dept_id order by d.Dept_name, c.Corname, c.Corlevel query="getcourses" value="dept_name,course_id" display="dept_name,corlabel" queryasroot="no" expand="yes,no"> the following example creates a tree that shows the ba...
Page 435
Cftree 435 parent = "#department#" expand="false" img="cd" href="#cgi.Script_name#?User_id=#emp_id#"> parent = "#lastname#, #firstname#" img="remote"> display = "contact information" parent = "#lastname#, #firstname#" expand = "false"> parent = "#department#" expand="false" img="cd" href="#cgi.Scrip...
Page 436
436 chapter 2: coldfusion tags cftreeitem description populates a form tree control, created with the cftree tag, with one or more elements. Category forms tags syntax value = "text" display = "text" parent = "parent_name" img = "filename" imgopen = "filename" href = "url" target = "url_target" quer...
Page 437
Cftreeitem 437 img optional; applet, object folder image name, filename, or file url for tree item icon. The following values are provided: • cd • computer • document • element • folder • floppy • fixed • remote you can also specify a custom image. To do so, include path and file extension; for exam...
Page 438
438 chapter 2: coldfusion tags usage this tag requires the client to download a java applet. Downloading an applet takes time; therefore, using this tag might be slightly slower than using an html form element or the cfinput tag to get the same information. For this tag to work properly. The browser...
Page 439
Cftreeitem 439 you requested information on #url.Cftreeitemkey#; user id #url.User_id# font = "arial narrow" highlighthref="no" hscroll="no"> display = "#lastname#, #firstname#" parent = "#department#" expand="no" href="#cgi.Script_name#?User_id=#emp_id#"> parent = "#lastname#, #firstname#"> display...
Page 440
440 chapter 2: coldfusion tags cftry description used with one or more cfcatch tags. Together, they catch and process exceptions in coldfusion pages. Exceptions are events that disrupt the normal flow of instructions in a coldfusion page, such as failed database operations, missing include files, an...
Page 441
Cftry 441 #i# #scurrent["id"]# (#scurrent["line"]#,#scurrent["column"]#) #scurrent["template"]#.
Page 442
442 chapter 2: coldfusion tags cfupdate description updates records in a data source from data in a coldfusion form or form scope. Category database manipulation tags syntax datasource = "ds_name" tablename = "table_name" tableowner = "name" tablequalifier = "qualifier" username = "username" passwor...
Page 443
Cfupdate 443 example select * from employees select * from employees where emp_id=#url.Id# #phonequery.Firstname# #phonequery.Lastname# password optional overrides the password value specified in odbc setup. Formfields optional (all on form, except keys) comma-delimited list of form fields to update...
Page 444
444 chapter 2: coldfusion tags cfwddx description serializes and deserializes cfml data structures to the xml-based wddx format. The wddx is an xml vocabulary for describing complex data structures in a standard, generic way. Implementing it lets you use the http protocol to such information among a...
Page 445
Cfwddx 445 usage coldfusion preserves the case of column names cases in javascript. The wddx2js and cfml2js actions create a wddxrecordset javascript object when they encounter a recordset java object. The serialized javascript code requires a wddx.Js file. This tag performs the following conversion...
Page 446
446 chapter 2: coldfusion tags #message_id# #thread_id# #username# serializing cfml data... Resulting wddx packet is: deserializing wddx packet... The recordset data is:... #message_id# #thread_id# #username#.
Page 447
Cfxml 447 cfxml description creates a coldfusion xml document object that contains the markup in the tag body. This tag can include xml and cfml tags. Coldfusion processes the cfml code in the tag body, and then assigns the resulting text to an xml document object variable, which is always stored in...
Page 448
448 chapter 2: coldfusion tags to change the declaration to specify another encoding, use the replace function. To specify the encoding of the text that is returned to a browser or other application, use the cfcontent tag. The following example illustrates this process: belgian waffles our famous be...
Page 449: Chapter 3
449 chapter 3 coldfusion functions this chapter lists and categorizes coldfusion markup language (cfml) functions. Contents function list. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 449 functions by category . . . . . . ....
Page 450
450 chapter 3: coldfusion functions arrayprepend getsoapresponseheader queryaddrow arrayresize gettempdirectory querynew arrayset gettempfile querysetcell arraysort gettickcount quotedvaluelist arraysum gettimezoneinfo rand arrayswap gettoken randomize arraytolist hash randrange asc hour refind asin...
Page 451
Function list 451 createtimespan isxmlelem structcopy createuuid isxmlnode structcount dateadd isxmlroot structdelete datecompare javacast structfind dateconvert jsstringformat structfindkey datediff lcase structfindvalue dateformat left structget datepart len structinsert day listappend structisemp...
Page 452
452 chapter 3: coldfusion functions functions by category the following tables list functions by their category or purpose. Array functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 452 conversion functions . . . . . . . . ....
Page 453
Functions by category 453 conversion functions date and time functions decision functions arraydeleteat arraymin arraysort listtoarray arrayinsertat arraynew arraysum arraytolist hash toscript xmlformat binarydecode lcase tostring xmlparse binaryencode listtoarray urldecode xmltransform charsetdecod...
Page 454
454 chapter 3: coldfusion functions display and formatting functions dynamic evaluation functions extensibility functions full-text search functions history coldfusion mx 6.1: these functions are deprecated. They might not work, and might cause errors, in a future release. International functions li...
Page 455
Functions by category 455 mathematical functions other functions query functions security functions string functions history coldfusion mx: coldfusion now supports the java ucs-2 representation of unicode character values 0–65535. (earlier releases supported ascii values.) compare left listgetat lis...
Page 456
456 chapter 3: coldfusion functions string-processing functions process any of these characters (including ascii 0 (nul) characters), and continue counting subsequent characters of the string, if any. (in earlier releases, some string-processing functions processed the ascii 0 (nul) character, but d...
Page 457
Function changes since coldfusion 5 457 xml functions function changes since coldfusion 5 the following tables list functions, parameters and values that have changed since coldfusion 5.0 and indicate the specific release in which the change was made. New functions, parameters, and values. . . . . ....
Page 458
458 chapter 3: coldfusion functions getauthuser all coldfusion mx getcontextroot all coldfusion mx 7 getencoding all coldfusion mx getlocaledisplayname coldfusion mx 7 getmetadata all coldfusion mx getpagecontext all coldfusion mx getprofilesections all coldfusion mx getsoaprequest all coldfusion mx...
Page 459
Function changes since coldfusion 5 459 deprecated functions, parameters, and values the following functions, parameters, and values are deprecated. Do not use them in coldfusion applications. They might not work, and might cause an error, in releases later than coldfusion mx. Toscript all coldfusio...
Page 460
460 chapter 3: coldfusion functions obsolete functions, parameters, and values the following functions, parameters, and values are obsolete. Do not use them in coldfusion applications. They do not work in releases later than coldfusion 5. Function parameter or value obsolete as of this coldfusion re...
Page 461: Chapter 3
Abs 461 abs description absolute-value function. The absolute value of a number is the number without its sign. Returns the absolute value of a number. Category mathematical functions function syntax abs(number ) see also sgn parameters example the absolute value of the following numbers: 1,3,-4,-3....
Page 462
462 chapter 3: coldfusion functions acos description arccosine function. The arccosine is the angle whose cosine is number. Returns the arccosine, in radians, of a number. Category mathematical functions function syntax acos(number) see also cos , sin , asin , tan , atn , pi parameters usage the ran...
Page 463
Addsoaprequestheader 463 addsoaprequestheader description adds a soap header to a web service request before making the request. Returns nothing. Category xml functions history coldfusion mx 7: added this function. Function syntax addsoaprequestheader(webservice, namespace, name, value [, mustunders...
Page 464
464 chapter 3: coldfusion functions // create the web service object. Ws = createobject("webservice", "http://localhost/soapheaders/ headerservice.Cfc?Wsdl"); // set the username header as a string. Addsoaprequestheader(ws, "http://mynamespace/", "username", "tom", false); // set the password header...
Page 465
Addsoapresponseheader 465 addsoapresponseheader description adds a soap response header to a web service response. Call only from within a cfc web service function that is processing a request as a soap web service. Returns nothing category xml functions history coldfusion mx 7: added this function....
Page 466
466 chapter 3: coldfusion functions save the following code as headerservice.Cfc in a folder called soapheaders under your web root. Test its operation, and specifically the operation of the addsoapresponseheader function, by executing the examples that invoke this web service. For example, see the ...
Page 467
Arrayappend 467 arrayappend description appends an array element to an array. Returns true, on successful completion. Category array functions function syntax arrayappend(array, value) see also arrayprepend ; “adding elements to an array” in chapter 5, “using arrays and structures,” in coldfusion mx...
Page 468
468 chapter 3: coldfusion functions arrayavg description calculates the average of the values in an array. Returns number. If the array parameter value is an empty array, returns zero. Category array functions , mathematical functions function syntax arrayavg(array) see also arraysum ; “basic array ...
Page 469
Arrayavg 469 the average of the numbers that you entered is #arrayavg(mynumberarray)#. Try again. You must enter at least two numeric values..
Page 470
470 chapter 3: coldfusion functions arrayclear description deletes the data in an array. Returns true, on successful completion. Category array functions function syntax arrayclear(array) see also arraydeleteat ; “functions for xml object management” in chapter 35, “using xml and wddx,” in coldfusio...
Page 471
Arraydeleteat 471 arraydeleteat description deletes an element from an array. When an element is deleted, coldfusion recalculates index positions. For example, in an array that contains the months of the year, deleting the element at position 5 removes the entry for may. After this, to delete the en...
Page 472
472 chapter 3: coldfusion functions #daysarray[1][1]# #daysarray[1][2]# #daysarray[2][1]# #daysarray[2][2]# #daysarray[3][1]# #daysarray[3][2]# we delete this element of the array: #arraydeleteat(daysarray,2)# this is what the array looks like after delete: #daysarray[1][1]# #daysarray[1][2]# #daysa...
Page 473
Arrayinsertat 473 arrayinsertat description inserts a value into an array. Array elements whose indexes are equal to or greater than the new position are incremented by one. The array length increases by one. Returns true, on successful completion. Category array functions function syntax arrayinser...
Page 474
474 chapter 3: coldfusion functions add an element before position 3: #arrayinsertat(daysarray,3,"wednesday")# now output the array as a list: #arraytolist(daysarray)#.
Page 475
Arrayisempty 475 arrayisempty description determines whether an array is empty of data elements. Returns true, if the array is empty; false, otherwise. Category array functions function syntax arrayisempty(array) see also arraylen , “functions for xml object management” in chapter 35, “using xml and...
Page 476
476 chapter 3: coldfusion functions arraylen description determines the number of elements in an array. Returns the number of elements in an array. Category array functions function syntax arraylen(array) see also arrayisempty ; “functions for xml object management” in chapter 35, “using xml and wdd...
Page 477
Arraymax 477 arraymax description array maximum function. Returns the largest numeric value in an array. If the array parameter value is an empty array, returns zero. Category array functions function syntax arraymax(array) parameters example this example uses arraymax to find the largest number in ...
Page 478
478 chapter 3: coldfusion functions arraymin description array minimum function. Returns the smallest numeric value in an array. If the array parameter value is an empty array, returns zero. Category array functions function syntax arraymin(array) parameters example this example uses arraymin to fin...
Page 479
Arraynew 479 arraynew description creates an array of 1–3 dimensions. Index array elements with square brackets: [ ]. Coldfusion arrays expand dynamically as data is added. Returns an array category array functions function syntax arraynew(dimension) parameters example is this an array? #isarray(myn...
Page 480
480 chapter 3: coldfusion functions arrayprepend description inserts an array element at the beginning of an array. Returns true, on successful completion. Category array functions function syntax arrayprepend(array, value) see also arrayappend ; “adding elements to an array” in chapter 5, “using ar...
Page 481
Arrayresize 481 arrayresize description resets an array to a specified minimum number of elements. This can improve performance, if used to size an array to its expected maximum. For more than 500 elements, use arrayresize immediately after using the arraynew tag. Coldfusion arrays expand dynamicall...
Page 482
482 chapter 3: coldfusion functions arrayset description in a one-dimensional array, sets the elements in a specified index range to a value. Useful for initializing an array after a call to arraynew . Returns true, on successful completion. Category array functions function syntax arrayset(array, s...
Page 483
Arraysort 483 arraysort description sorts array elements numerically or alphanumerically. Returns true, if sort is successful; false, otherwise. Category array functions , list functions function syntax arraysort(array, sort_type [, sort_order ]) history coldfusion mx: • changed thrown exceptions: t...
Page 484
484 chapter 3: coldfusion functions throws if an array element is other than a simple element, this function throws an arraysortsimplevalueexception error. If sort_type is numeric and an array element is not numeric, this function throws a valuenotnumeric error. Example select firstname, lastname fr...
Page 485
Arraysum 485 arraysum description array sum function. Returns the sum of values in an array. If the array parameter value is an empty array, returns zero. Category array functions , mathematical functions function syntax arraysum(array) parameters example this example uses arraysum to add two number...
Page 486
486 chapter 3: coldfusion functions arrayswap description swaps array values of an array at specified positions. This function is more efficient than multiple cfset tags. Returns true, on successful completion. Category array functions function syntax arrayswap(array, position1, position2) see also ...
Page 487
Arraytolist 487 arraytolist description converts a one-dimensional array to a list. Returns delimited list, as a string. Category array functions , conversion functions , list functions function syntax arraytolist(array [, delimiter ]) parameters example select firstname, lastname from employees the...
Page 488
488 chapter 3: coldfusion functions asc description determines the value of a character. Returns the value of the first character of a string; if string is empty, returns zero. Category string functions function syntax asc(string) see also chr history coldfusion mx: changed unicode support: coldfusi...
Page 489
Asin 489 asin description determines the arcsine of a number. The arcsine is the angle whose sine is number. Returns the arcsine, in radians, of a number. Category mathematical functions function syntax asin(number) see also sin , cos , acos , tan , atn , pi parameters usage the range of the result ...
Page 490
490 chapter 3: coldfusion functions value must be between 1 and -1,inclusive. Enter a number to get its arcsine in radians and degrees..
Page 491
Atn 491 atn description arctangent function. The arctangent is the angle whose tangent is number. Returns the arctangent, in radians, of a number. Category mathematical functions function syntax atn(number) see also atn , sin , asin , cos , acos , pi parameters usage the range of the result is - π /...
Page 492
492 chapter 3: coldfusion functions authenticatedcontext description this function is obsolete. Use the newer security tools; see “conversion functions” on page 453 and chapter 16, “securing applications” in coldfusion mx developer’s guide. History coldfusion mx: this function is obsolete. It does n...
Page 493
Authenticateduser 493 authenticateduser description this function is obsolete. Use the newer security tools; see “conversion functions” on page 453 and chapter 16, “securing applications” in coldfusion mx developer’s guide. History coldfusion mx: this function is obsolete. It does not work in coldfu...
Page 494
494 chapter 3: coldfusion functions binarydecode description converts a string to a binary object. Used to convert binary data that has been encoded into string format back into binary data. Returns a binary object. Category conversion functions , string functions function syntax binarydecode(string...
Page 495
Binarydecode 495 example the following example reads a gif file as binary data, converts it to a binary-encoded string, converts the binary-encoded data back to binary data and writes the result to a file. It displays the encoded string and the image in the output file. File="c:\cfusionmx7\wwwroot\c...
Page 496
496 chapter 3: coldfusion functions binaryencode description converts binary data to a string. Returns an encoded string representing the binary data. Category conversion functions , string functions function syntax binaryencode(binarydata, encoding) see also binarydecode , charsetencode , charsetde...
Page 497
Binaryencode 497 • isbinary for checking variables for binary format • len for determining the length of a binary object example the following example reads a gif file as binary data, converts it to a binary-encoded string, converts the binary-encoded data back to binary data, and writes the result ...
Page 498
498 chapter 3: coldfusion functions bitand description performs a bitwise logical and operation. Returns the bitwise and of two long integers. Category mathematical functions function syntax bitand(number1, number2) see also bitnot , bitor , bitxor parameters usage bit functions operate on 32-bit si...
Page 499
Bitmaskclear 499 bitmaskclear description performs a bitwise mask clear operation. Returns a number, bitwise cleared, with length bits beginning at start. Category mathematical functions function syntax bitmaskclear(number, start, length) see also bitmaskread , bitmaskset parameters usage bit functi...
Page 500
500 chapter 3: coldfusion functions bitmaskread description performs a bitwise mask read operation. Returns an integer, created from length bits of number, beginning at start. Category mathematical functions function syntax bitmaskread(number, start, length) see also bitmaskclear , bitmaskset parame...
Page 501
Bitmaskset 501 bitmaskset description performs a bitwise mask set operation. Returns a number, bitwise masked with length bits of mask beginning at start. Category mathematical functions function syntax bitmaskset(number, mask, start, length) see also bitmaskclear , bitmaskread parameters usage bit ...
Page 502
502 chapter 3: coldfusion functions bitnot description performs a bitwise logical not operation. Returns a number; the bitwise not of a long integer. Category mathematical functions function syntax bitnot(number) see also bitand , bitor , bitxor parameters usage bit functions operate on 32-bit signe...
Page 503
Bitor 503 bitor description performs a bitwise logical or operation. Returns a number; the bitwise or of two long integers. Category mathematical functions function syntax bitor(number1, number2) see also bitand , bitnot , bitxor parameters usage bit functions operate on 32-bit signed integers, in t...
Page 504
504 chapter 3: coldfusion functions bitshln description performs a bitwise shift-left, no-rotation operation. Returns a number, bitwise shifted without rotation to the left by count bits. Category mathematical functions function syntax bitshln(number, count) see also bitshrn parameters usage bit fun...
Page 505
Bitshrn 505 bitshrn description performs a bitwise shift-right, no-rotation operation. Returns a number, bitwise shifted, without rotation, to the right by count bits. Category mathematical functions function syntax bitshrn(number, count) see also bitshln parameters usage bit functions operate on 32...
Page 506
506 chapter 3: coldfusion functions bitxor description performs a bitwise logical xor operation. Returns bitwise xor of two long integers. Category mathematical functions function syntax bitxor(number1, number2) see also bitand , bitnot , bitor parameters usage bit functions operate on 32-bit signed...
Page 507
Ceiling 507 ceiling description determines the closest integer that is greater than a specified number. Returns the closest integer that is greater than a given number. Category mathematical functions function syntax ceiling(number) see also int , fix , round parameters example the ceiling of 3.4 is...
Page 508
508 chapter 3: coldfusion functions charsetdecode description converts a string to a binary representation. Returns a binary object that represents the string. Category conversion functions , string functions function syntax charsetdecode(string, encoding) see also binarydecode , binaryencode , char...
Page 509
Charsetdecode 509 example the following example uses the charsetdecode function to convert a string from a form to a binary object, and uses the charsetencode function to convert it back to the original value. You can change the character encoding that coldfusion uses for the conversion. Notice that...
Page 510
510 chapter 3: coldfusion functions the following four characters are not in all character encodings: ½àç÷.
Page 511
Charsetencode 511 charsetencode description uses the specified encoding to convert binary data to a string. Returns a string representation of the binary object. Category conversion functions , string functions function syntax charsetencode(binaryobject, encoding) see also binarydecode , binaryencod...
Page 512
512 chapter 3: coldfusion functions example the following example uses the charsetdecode function to convert a string from a form to a binary object, and uses the charsetencode function to convert it back to the original value. You can change the character encoding that coldfusion uses for the conve...
Page 513
Charsetencode 513 the following four characters are not in all character encodings: ½àç÷.
Page 514
514 chapter 3: coldfusion functions chr converts a numeric value to a ucs-2 character. Returns a character with the specified ucs-2 character code. Category string functions function syntax chr(number) see also asc history coldfusion mx: changed unicode support: coldfusion supports the java ucs-2 re...
Page 515
Chr 515 maxlength="5" >.
Page 516
516 chapter 3: coldfusion functions cjustify description centers a string in a field length. Returns string, center-justified by adding spaces before or after the input parameter. If length is less than the length of the input parameter string, the string is returned unchanged. Category display and ...
Page 517
Compare 517 compare description performs a case-sensitive comparison of two strings. Returns • -1, if string1 is less than string2 • 0, if string1 is equal to string2 • 1, if string1 is greater than string2 category string functions function syntax compare(string1, string2) see also comparenocase , ...
Page 518
518 chapter 3: coldfusion functions string 1 string 2.
Page 519
Comparenocase 519 comparenocase description performs a case-insensitive comparison of two strings. Returns an indicator of the difference: • a negative number, if string1 is less than string2 • 0, if string1 is equal to string2 • a positive number, if string1 is greater than string2 category string ...
Page 520
520 chapter 3: coldfusion functions string 1 string 2.
Page 521
Cos 521 cos description calculates the cosine of an angle that is entered in radians. Returns a number; the cosine of the angle. Category mathematical functions function syntax cos(number) see also acos , sin , asin , tan , atn , pi parameters usage the range of the result is -1 to 1. To convert deg...
Page 522
522 chapter 3: coldfusion functions enter an angle in degrees to get its cosine:.
Page 523
Createdate 523 createdate description creates a date/time object. Returns a date/time value. Category date and time functions function syntax createdate(year, month, day) see also createdatetime , createodbcdate ; “date-time functions and queries when odbc is not supported” in chapter 3, “using cold...
Page 524
524 chapter 3: coldfusion functions #dateformat(createdate(form.Year, form.Month, form.Day), "mmm-dd- yyyy")# #dateformat(createdatetime(form.Year, form.Month, form.Day, 12,13,0))# #dateformat(createodbcdate(yourdate), "mmmm d, yyyy")# #dateformat(createodbcdatetime(yourdate), "d/m/yy")# enter the y...
Page 525
Createdatetime 525 createdatetime description creates a date-time object. Returns a date/time value. Category date and time functions function syntax createdatetime(year, month, day, hour, minute, second) see also createdate , createtime , createodbcdatetime , now ; “date-time functions and queries ...
Page 526
526 chapter 3: coldfusion functions the same value can be formatted with dateformat: #dateformat(createdate(form.Year, form.Month, form.Day), "mmm-dd-yyyy")# #dateformat(createdatetime(form.Year, form.Month, form.Day, form.Hour, form.Minute, form.Second))# #dateformat(createodbcdate(yourdate), "mmmm...
Page 527
Createobject 527 createobject description creates a coldfusion object, of a specified type. Returns an object, of the specified type. Note: you can enable and disable this function in the coldfusion administrator, coldfusion basic security, tag restrictions page. Category extensibility functions his...
Page 528
528 chapter 3: coldfusion functions createobject: com object description the createobject function can create a component object model (com) object. To create a com object, you must provide this information: • the object’s program id or filename • the methods and properties available to the object t...
Page 529
Createobject 529 usage the following example creates the windows collaborative data objects (cdo) for nts newmail object to send mail. You would use this code within a cfscript tag. Mailer = createobject("com", "cdonts.Newmail");.
Page 530
530 chapter 3: coldfusion functions createobject: component object description the createobject function can create an instance of a coldfusion component (cfc) object. Returns a component object. Function syntax createobject (type, component-name) see also chapter 10, “building and using coldfusion ...
Page 531
Createobject 531 createobject: corba object description the createobject function can call a method on a corba object. The object must be defined and registered for use. Returns a handle to a corba interface. Function syntax createobject (type, context, class, locale) see also chapter 38, “integrati...
Page 532
532 chapter 3: coldfusion functions coldfusion enterprise supports corba through the dynamic invocation interface (dii). To use this function with corba objects, you must provide the name of the file that contains a string version of the ior, or the object’s naming context in the naming service. You...
Page 533
Createobject 533 createobject: java or ejb object description the createobject function can create a java object, and, by extension, an ejb object. Returns a java object. Function syntax createobject (type, class) parameters usage any java class available in the class path that is specified in the c...
Page 534
534 chapter 3: coldfusion functions createobject: web service object description this function can create a web service object. Returns a web service object. Function syntax createobject (type, urltowsdl [, portname ]) parameters usage you can use the createobject function to create a web service. E...
Page 535
Createodbcdate 535 createodbcdate description creates an odbc date object. Returns a date object, in normalized odbc date format. Category date and time functions function syntax createodbcdate(date) see also createdate , createodbcdatetime parameters usage this function does not parse or validate v...
Page 536
536 chapter 3: coldfusion functions #dateformat(createdatetime(form.Year, form.Month, form.Day, form.Hour, form.Minute, form.Second))# #dateformat(createodbcdate(yourdate), "mmmm d, yyyy")# #dateformat(createodbcdatetime(yourdate), "d/m/yy")# enter the year, month and day, as integers: year required...
Page 537
Createodbcdatetime 537 createodbcdatetime description creates an odbc date-time object. Returns a date-time object, in odbc timestamp format. Category date and time functions function syntax createodbcdatetime(date) see also createdatetime , createodbcdate , createodbctime , now ; “evaluation and ty...
Page 538
538 chapter 3: coldfusion functions #dateformat(createodbcdate(yourdate), "mmmm d, yyyy")# #dateformat(createodbcdatetime(yourdate), "d/m/yy")# enter a year, month and day, as integers: year type="text" name="year" value="1998" validate="integer" required="yes"> month type="text" name="month" value=...
Page 539
Createodbctime 539 createodbctime description creates an odbc time object. Returns a time object, in odbc timestamp format. Category date and time functions function syntax createodbctime(date) see also createodbcdatetime , createtime , “evaluation and type conversion issues” in chapter 3, “using co...
Page 540
540 chapter 3: coldfusion functions createtime description creates a time variable. Returns a time variable. Category date and time functions function syntax createtime(hour, minute, second) see also createodbctime , createdatetime ; “evaluation and type conversion issues” in chapter 3, “using coldf...
Page 541
Createtime 541 message="you must enter a value for seconds (0-59)" validate="integer" required="yes">.
Page 542
542 chapter 3: coldfusion functions createtimespan description creates a date/time object that defines a time period. You can add or subtract it from other date- time objects and use it with the cachedwithin attribute of cfquery . Returns a date-time object. Category date and time functions function...
Page 543
Createtimespan 543 cachedwithin = "#createtimespan(0, 6, 0, 0)#"> select parkname, region, state from parks order by parkname, state park name region state maxrows = "#maxrows#"> #getparks.Currentrow# #parkname# #region# #state# maxrows = "#maxrows#"> #getparks.Currentrow# #parkname# #region# #state...
Page 544
544 chapter 3: coldfusion functions createuuid description creates a universally unique identifier (uuid). A uuid is a 35-character string representation of a unique 128-bit integer. Returns a coldfusion format uuid, in the format xxxxxxxx-xxxx-xxxx-xxxxxxxxxxxxxxxx , where x is a hexadecimal digit ...
Page 545
Dateadd 545 dateadd description adds units of time to a date. Returns a date/time object. Category date and time functions function syntax dateadd("datepart", number, "date") see also dateconvert , datepart , createtimespan history coldfusion mx 6.1: added the datepart character l or l to represent ...
Page 546
546 chapter 3: coldfusion functions select username, subject, posted from messages this example uses dateadd to determine when a message in the database will expire. Currently, messages older than #value# years quarters months days of year weekdays weeks hours minutes seconds years are expired. Colo...
Page 547
Dateadd 547 years months days weeks hours minutes seconds.
Page 548
548 chapter 3: coldfusion functions datecompare description performs a full date/time comparison of two dates. Returns • -1, if date1 is earlier than date2 • 0, if date1 is equal to date2 • 1, if date1 is later than date2 category date and time functions function syntax datecompare("date1", "date2" ...
Page 549
Datecompare 549 #timeformat(form.Date2)# (date 2) the dates are not equal #timeformat(form.Date1)# to #dateformat(form.Date2)# #timeformat(form.Date2)# (date 2) the dates are equal! #timeformat(form.Date1)# than #dateformat(form.Date2)# #timeformat(form.Date2)# (date 2) the dates are not equal date ...
Page 550
550 chapter 3: coldfusion functions.
Page 551
Dateconvert 551 dateconvert description converts local time to coordinated universal time (utc), or utc to local time. The function uses the daylight savings settings in the executing computer to compute daylight savings time, if required. Returns utc- or local-formatted time object. Category date a...
Page 552
552 chapter 3: coldfusion functions your date and time value, converted to coordinated universal time (utc): #yourutc#. Your utc date and time, converted back to local date and time: #dateconvert("utc2local", yourutc)#. Type the date and time, and press enter to see the conversion. Enter year, month...
Page 553
Datediff 553 datediff description determines the integer number of units by which date1 is less than date2. Returns a number of units, of type datepart. Category date and time functions function syntax datediff("datepart", "date1", "date2") see also dateadd , datepart , createtimespan history coldfu...
Page 554
554 chapter 3: coldfusion functions enclose string constant dates in quotation marks. If the text contains only numbers (such 1932), and is not surrounded by quotation marks, coldfusion interprets it as a date/time object, resulting in an incorrect value. Example this example uses datediff to determ...
Page 555
Datediff 555 please enter two valid date/time values, formatted like this: #dateformat(now())# date 1 #dateformat(now())# cfoutput>"> date 2 #dateformat(now())# cfoutput>"> what kind of unit to show difference? Years quarters months days of year days weekdays weeks hours minutes seconds ..
Page 556
556 chapter 3: coldfusion functions dateformat description formats a date value using u.S. Date formats. For international date support, use lsdateformat . Returns a text string representing the date formatted according to the mask. If no mask is specified, returns the value in dd-mmm-yy format. Cat...
Page 557
Dateformat 557 usage when passing a date/time object as a string, you must enclose it in quotation marks. Otherwise, it is interpreted as a numeric representation of a date/time object. Note: you can pass the createdate function or now function as the date parameter of this function; for example: #d...
Page 558
558 chapter 3: coldfusion functions datepart description extracts a part from a date value. Returns part of a date, as an integer. Category date and time functions function syntax datepart("datepart", "date") see also dateadd , dateconvert history coldfusion mx 6.1: added the datepart character l or...
Page 559
Datepart 559.
Page 560
560 chapter 3: coldfusion functions day description determines the day of the month, in a date. Returns the ordinal for the day of the month, ranging from 1 to 31. Category date and time functions function syntax day("date") see also dayofweek , dayofweekasstring , dayofyear , daysinmonth , daysinye...
Page 561
Dayofweek 561 dayofweek description determines the day of the week, in a date. Returns the ordinal for the day of the week, as an integer in the range 1 (sunday) to 7 (saturday). Category date and time functions function syntax dayofweek("date") see also day , dayofweekasstring , dayofyear , daysinm...
Page 562
562 chapter 3: coldfusion functions dayofweekasstring description determines the day of the week, in a date, as a string function. Returns the day of the week, as a string in the current locale, that corresponds to day_of_week. Category date and time functions , string functions function syntax dayo...
Page 563
Dayofyear 563 dayofyear description determines the day of the year, in a date. Returns the ordinal value of day of the year, as an integer. Category date and time functions function syntax dayofyear("date") see also day , dayofweek , dayofweekasstring , daysinmonth , daysinyear , firstdayofmonth par...
Page 564
564 chapter 3: coldfusion functions daysinmonth description determines the number of days in a month. Returns the number of days in the month in date. Category date and time functions function syntax daysinmonth("date") see also day , dayofweek , dayofweekasstring , dayofyear , daysinyear , firstday...
Page 565
Daysinyear 565 daysinyear description determines the number of days in a year. Returns the number of days in a year. Category date and time functions function syntax daysinyear("date") see also day , dayofweek , dayofweekasstring , dayofyear , daysinmonth , daysinyear , firstdayofmonth , isleapyear ...
Page 566
566 chapter 3: coldfusion functions de description escapes any double-quotation marks in the parameter and wraps the result in double-quotation marks. Returns parameter, surrounded by double-quotation marks, with any inner double-quotation marks escaped. Category dynamic evaluation functions functio...
Page 567
De 567 the following example shows how you can use the de function and number signs together, and shows how the function works with an iif function: the expression is #myresult# coldfusion processes this code as follows: 1. Coldfusion sets the variables var1 and var2 to be the strings blue and green...
Page 568
568 chapter 3: coldfusion functions try a simple expression, such as "2+2". #cfcatch.Message#.
Page 569
Decimalformat 569 decimalformat description converts a number to a decimal-formatted string. Returns a number as a string formatted with two decimal places and a thousands separator. Category display and formatting functions function syntax decimalformat(number) see also dollarformat , numberformat ...
Page 570
570 chapter 3: coldfusion functions decrementvalue description decrements the integer part of a number. Returns integer part of number, decremented by one. Category mathematical functions function syntax decrementvalue(number) see also incrementvalue parameters example returns the integer part of a ...
Page 571
Decrypt 571 decrypt description decrypts a string that is encrypted using a standard encryption technique, including strings encrypted by the encrypt function. Returns an unencrypted string. Category security functions , string functions function syntax decrypt(encrypted_string, key[, algorithm[, en...
Page 572
572 chapter 3: coldfusion functions usage this function uses a symmetric key-based algorithm, in which the same key is used to encrypt and decrypt a string. The parameter values must match the values used to encode string. The security of the encrypted string depends on maintaining the secrecy of th...
Page 573
Decrypt 573 select the algorithm cfmx_compat aes des desede input your key (used for cfmx_compat encryption only) enter string to encrypt this string will be encrypted (you can replace it with more typing)..
Page 574
574 chapter 3: coldfusion functions deleteclientvariable description deletes a client variable. (to test for the existence of a variable, use isdefined .) returns true, if the variable is successfully deleted; false, otherwise. Category other functions function syntax deleteclientvariable("name") se...
Page 575
Directoryexists 575 directoryexists description determines whether a directory exists. Returns yes, if the specified directory exists; no, otherwise. Category system functions function syntax directoryexists(absolute_path) see also fileexists parameters example your directory exists. Directory name:...
Page 576
576 chapter 3: coldfusion functions dollarformat description formats a string in u.S. Format. (for other currencies, use lscurrencyformat or lseurocurrencyformat .) returns a number as a string, formatted with two decimal places, thousands separator, and dollar sign. If number is negative, the retur...
Page 577
Duplicate 577 duplicate description returns a clone, also known as a deep copy, of a variable. There is no reference to the original variable. Returns a clone of a variable. Category structure functions , system functions function syntax duplicate(variable_name) see also structcopy , other structure...
Page 578
578 chapter 3: coldfusion functions encrypt description encrypts a string using a specific algorithm and encoding method. Returns string; can be much longer than the original string. Category security functions , string functions function syntax encrypt(string, key[, algorithm[, encoding]])) see als...
Page 579
Encrypt 579 usage this function uses a symmetric key-based algorithm, in which the same key is used to encrypt and decrypt a string. The security of the encrypted string depends on maintaining the secrecy of the key. For all algorithms except the default algorithm, coldfusion mx 7 uses the java cryp...
Page 580
580 chapter 3: coldfusion functions select the encoding uu base64 hex select the algorithm cfmx_compat aes des desede input your key (used for cfmx_compat encryption only) enter string to encrypt this string will be encrypted (you can replace it with more typing)..
Page 581
Evaluate 581 evaluate description evaluates one or more string expressions, dynamically, from left to right. (the results of an evaluation on the left can have meaning in an expression to the right.) returns the result of evaluating the rightmost expression. Returns an object; the result of the eval...
Page 582
582 chapter 3: coldfusion functions exp description calculates the exponent whose base is e that represents number. The constant e equals 2.71828182845904, the base of the natural logarithm. This function is the inverse of log , the natural logarithm of number. Returns the constant e, raised to the ...
Page 583
Expandpath 583 expandpath description creates an absolute, platform-appropriate path that is equivalent to the value of relative_path , appended to the base path. This function (despite its name) can accept an absolute or relative path in the relative_path parameter the base path is the currently ex...
Page 584
584 chapter 3: coldfusion functions example name="mydirectory" sort="name asc, size desc"> text="#name#"> text="#size#"> please enter a file name enter the name of a file in this directory name="mydirectory" sort="name asc, size desc"> text="#name#"> text="#size#"> please enter a file name text="#na...
Page 585
Fileexists 585 fileexists description determines whether a file exists. Returns yes, if the file specified in the parameter exists; no, otherwise. Category system functions , decision functions function syntax fileexists(absolute_path) see also directoryexists , expandpath , gettemplatepath paramete...
Page 586
586 chapter 3: coldfusion functions find description finds the first occurrence of a substring in a string, from a specified start position. The search is case-sensitive. Returns a number; the position of substring in string; or 0, if substring is not in string. Category string functions function sy...
Page 587
Findnocase 587 findnocase description finds the first occurrence of a substring in a string, from a specified start position. If substring is not in string, returns zero. The search is case-insensitive. Returns the position of substring in string; or 0, if substring is not in string. Category string...
Page 588
588 chapter 3: coldfusion functions findoneof description finds the first occurrence of any one of a set of characters in a string, from a specified start position. The search is case-sensitive. Returns the position of the first member of set found in string; or 0, if no member of set is found in st...
Page 589
Firstdayofmonth 589 firstdayofmonth description determines the ordinal (day number, in the year) of the first day of the month in which a given date falls. Returns a number corresponding to a day-number in a year. Category date and time functions function syntax firstdayofmonth(date) see also day , ...
Page 590
590 chapter 3: coldfusion functions fix description converts a real number to an integer. Returns if number is greater than or equal to 0, the closest integer less than number. If number is less than 0, the closest integer greater than number. Category mathematical functions function syntax fix(numb...
Page 591
Formatbasen 591 formatbasen description converts number to a string, in the base specified by radix. Returns string that represents number, in the base radix. Category display and formatting functions , mathematical functions , string functions function syntax formatbasen(number, radix) see also inp...
Page 592
592 chapter 3: coldfusion functions generatesecretkey description gets a secure key value for use in the encrypt function. Returns a string containing the encryption key. Category security functions , string functions function syntax generatesecretkey(algorithm) see also decrypt , encrypt history co...
Page 593
Generatesecretkey 593 example the following example encrypts and decrypts a text string. It lets you specify the encryption algorithm and encoding technique. It also has a field for a key seed to use with the cfmx_compat algorithm. For all other algorithms, it uses the generatesecretkey function to ...
Page 594
594 chapter 3: coldfusion functions desede input your key (used for cfmx_compat encryption only) enter string to encrypt this string will be encrypted (you can replace it with more typing)..
Page 595
Getauthuser 595 getauthuser description gets the name of an authenticated user. Returns the name of an authenticated user. Category security functions function syntax getauthuser() see also isuserinrole , cflogin , cfloginuser ; chapter 16, “securing applications” in coldfusion mx developer’s guide ...
Page 596
596 chapter 3: coldfusion functions getbasetagdata description used within a custom tag. Finds calling (ancestor) tag by name and accesses its data. Returns an object that contains data (variables, scopes, and so on) from an ancestor tag. If there is no ancestor by the specified name, or if the ance...
Page 597
Getbasetaglist 597 getbasetaglist description gets ancestor tag names, starting with the parent tag. Returns a comma-delimited list of uppercase ancestor tag names, as a string. The first list element is the current tag. If the current tag is nested, the next element is the parent tag. If the functi...
Page 598
598 chapter 3: coldfusion functions getbasetemplatepath description gets the absolute path of an application’s base page. Returns the absolute path of the application base page, as a string. Category other functions , system functions function syntax getbasetemplatepath() see also getcurrenttemplate...
Page 599
Getclientvariableslist 599 getclientvariableslist description finds the client variables to which a page has write access. Returns comma-delimited list of non-read-only client variables, as a string. Category list functions , other functions function syntax getclientvariableslist() see also deletecl...
Page 600
600 chapter 3: coldfusion functions getcontextroot description returns path to the j2ee server context root for the current request. Returns the path from the web root to the context root for the current page. The path starts with a forward slash character (/) but does not end with a forward slash c...
Page 601
Getcurrenttemplatepath 601 getcurrenttemplatepath description gets the path of the page that calls this function. Returns the absolute path of the page that contains the call to this function, as a string. Category system functions function syntax getcurrenttemplatepath() see also getbasetemplatepat...
Page 602
602 chapter 3: coldfusion functions getdirectoryfrompath description extracts a directory from an absolute path. Returns absolute path, without the filename. The last character is a forward or backward slash, depending on the operating system. Category system functions function syntax getdirectoryfr...
Page 603
Getdirectoryfrompath 603 (try expandpath.Cfm).
Page 604
604 chapter 3: coldfusion functions getencoding description returns the encoding (character set) of the form or url scope. Returns string; the character encoding of the specified scope. Category international functions , system functions function syntax getencoding(scope_name) see also setencoding ,...
Page 605
Getencoding 605 writeoutput("the encoding is " & theencoding);.
Page 606
606 chapter 3: coldfusion functions getexception description used with the cftry and cfcatch tags. Retrieves a java exception object from a java object. Returns any java exception object raised by a previous method call on the java object. Category system functions syntax getexception(object) parame...
Page 607
Getfilefrompath 607 getfilefrompath description extracts a filename from an absolute path. Returns filename, as a string. Category system functions function syntax getfilefrompath(path) see also expandpath , getcurrenttemplatepath parameters example the current directory is: #getdirectoryfrompath(th...
Page 608
608 chapter 3: coldfusion functions getfunctionlist description displays a list of the functions that are available in coldfusion. Returns a structure of functions. Category system functions function syntax getfunctionlist() example getfunctionlist()> #structcount(flist)# functions #key#.
Page 609
Getgatewayhelper 609 getgatewayhelper description gets a java gatewayhelper object that provides methods and properties for use with a coldfusion event gateway. Returns a java gatewayhelper object. Category extensibility functions function syntax getgatewayhelper(gatewayid) see also sendgatewaymessa...
Page 610
610 chapter 3: coldfusion functions example if an event gateway’s helper class includes an addbuddy method that takes a single string parameter, you could use the following code to get the gatewayhelper object and add a buddy to the buddies list: myhelper = getgatewayhelper(mygatewayid); status = my...
Page 611
Gethttprequestdata 611 gethttprequestdata description makes http request headers and body available to cfml pages. Useful for capturing soap request data, which can be delivered in an http header. Returns a coldfusion structure. Category system functions function syntax gethttprequestdata() returns ...
Page 612
612 chapter 3: coldfusion functions http_content --- #x.Content#.
Page 613
Gethttptimestring 613 gethttptimestring description gets the current time, in the universal time code (utc). Returns the time, as a string, according to the http standard described in rfc 1123 and its underlying rfc, 822. This format is commonly used in internet protocols, including http. Category d...
Page 614
614 chapter 3: coldfusion functions getk2serverdoccount description this function is deprecated. Returns the number of collection metadata items stored in verity collections. Category full-text search functions , query functions function syntax getk2serverdoccount() see also getk2serverdoccountlimit...
Page 615
Getk2serverdoccountlimit 615 getk2serverdoccountlimit description this function is deprecated. Returns number of collection metadata items that the k2 server permits, as an integer category full-text search functions , query functions function syntax getk2serverdoccountlimit() see also getk2serverdo...
Page 616
616 chapter 3: coldfusion functions getlocale description gets the current coldfusion mx geographic/language locale value. To set the default display format of date, time, number, and currency values in a coldfusion application session, you use the setlocale function. Returns the current locale valu...
Page 617
Getlocale 617 for more information, see “locales” in chapter 17, “developing globalized applications,” in coldfusion mx developer’s guide. Example initial locale's coldfusion name: #getlocale()# changing locale to #form.Mylocale# new locale: #getlocale()# #i#.
Page 618
618 chapter 3: coldfusion functions getlocaledisplayname description gets a locale value and displays the name in a manner that is appropriate to a specific locale. By default, gets the current locale in the current locale’s language. Returns the localized display name of the locale, in the language...
Page 619
Getlocaledisplayname 619 new locale's coldfusion name: #newlocale# new locale's display name in current locale: #getlocaledisplayname()# new locale's display name in old locale: #getlocaledisplayname(newlocale, oldlocale)# new locale's display name in en_us: #getlocaledisplayname(newlocale, "en_us")...
Page 620
620 chapter 3: coldfusion functions getmetadata description gets metadata (such as the methods, properties, and parameters of a component) associated with an object that is deployed on the coldfusion server. Returns structured metadata information: for coldfusion components (cfcs) and user defined f...
Page 621
Getmetadata 621 the following table lists the data returned by the function for supported object types: object field description component a structure containing the following fields: displayname value of the cfcomponent tag displayname attribute, if any. Extends metadata for the component’s ancesto...
Page 622
622 chapter 3: coldfusion functions note: use the this scope to access component metadata inside the cfc. The this scope is available at runtime in the component body and in the cfc methods. It is used to read and write variables that are present during the life of the component. For more informatio...
Page 623
Getmetadata 623 select * from employees #employeemeta[i].Name# #employeemeta[i].Typename# #employeemeta[i].Iscasesensitive#.
Page 624
624 chapter 3: coldfusion functions getmetricdata description gets server performance metrics. Returns coldfusion structure that contains metric data, depending on the mode value. Category system functions function syntax getmetricdata(mode) history coldfusion mx: deprecated the cachepops parameter....
Page 625
Getmetricdata 625 example current perfmonitor data is: instancename:#pmdata.Instancename# pagehits:#pmdata.Pagehits# reqqueued: #pmdata.Reqqueued# dbhits: #pmdata.Dbhits# reqrunning: #pmdata.Reqrunning# reqtimedout: #pmdata.Reqtimedout# bytesin: #pmdata.Bytesin# bytesout: #pmdata.Bytesout# avgqueuet...
Page 626
626 chapter 3: coldfusion functions getpagecontext description gets the current coldfusion mx pagecontext object that provides access to page attributes and configuration, request, and response objects. Returns the current coldfusion mx java pagecontext java object. Category system functions functio...
Page 627
Getprofilesections 627 getprofilesections description gets all the sections of an initialization file. An initialization file assigns values to configuration variables, also known as entries, that are set when the system boots, the operating system comes up, or an application starts. An initializati...
Page 628
628 chapter 3: coldfusion functions getprofilestring description gets an initialization file entry. An initialization file assigns values to configuration variables, also known as entries, that are set when the system boots, the operating system comes up, or an application starts. An initialization ...
Page 629
Getprofilestring 629.
Page 630
630 chapter 3: coldfusion functions getsoaprequest description returns an xml object that contains the entire soap request. Usually called from within a web service cfc. Returns an xml object that contains the entire soap request. Category xml functions history coldfusion mx 7: added this function. ...
Page 631
Getsoaprequest 631 different than shown here. Note, too, that getsoaprequest is called from the client here, whereas often it would be called from within the web service cfc. ---> ws = createobject("webservice", "http://localhost/soapheaders/headerservice.Cfc?Wsdl"); ws.Echo_me("hello world"); req =...
Page 632
632 chapter 3: coldfusion functions getsoaprequestheader description obtains a soap request header. Call only from within a cfc web service function that is processing a request as a soap web service. Returns a soap request header. Category xml functions history coldfusion mx 7: added this function....
Page 633
Getsoaprequestheader 633 access="remote" output="false" returntype="string" displayname="echo test" hint="header test"> "true")> as xml: " & xmlusername> "true")> as xml: " & xmlpassword> "authorized value", false)> access="remote" output="false" returntype="string" displayname="echo test" hint="hea...
Page 634
634 chapter 3: coldfusion functions getsoapresponse description returns an xml object that contains the entire soap response after invoking a web service. Returns an xml object that contains the entire soap response. Category xml functions history coldfusion mx 7: added this function. Function synta...
Page 635
Getsoapresponseheader 635 getsoapresponseheader description returns a soap response header. Call this function from within code that is invoking a web service after making a web service request. Returns a soap response header. Category xml functions history coldfusion mx 7: added this function. Func...
Page 636
636 chapter 3: coldfusion functions execute the following example to see how the getsoapresponseheader function operates: // create the web service object ws = createobject("webservice", "http://localhost/soapheaders/ headerservice.Cfc?Wsdl"); // set the username header as a string addsoaprequesthea...
Page 637
Gettempdirectory 637 gettempdirectory description gets the path of the directory that coldfusion uses for temporary files. The directory depends on the account under which coldfusion is running and other factors. Before using this function in an application, test to determine the directory it return...
Page 638
638 chapter 3: coldfusion functions gettempfile description creates a temporary file in a directory whose name starts with (at most) the first three characters of prefix. Returns name of a temporary file, as a string. Category system functions function syntax gettempfile(dir, prefix) see also gettem...
Page 639
Gettemplatepath 639 gettemplatepath description this function is deprecated. Use the getbasetemplatepath function instead. Gets the absolute path of an application’s base page. History coldfusion mx: deprecated this function. It might not work, and it might cause an error, in later releases..
Page 640
640 chapter 3: coldfusion functions gettickcount description returns the current value of an internal millisecond timer. Returns a string representation of the system time, in milliseconds. Category date and time functions , system functions function syntax gettickcount() usage this function is usef...
Page 641
Gettimezoneinfo 641 gettimezoneinfo description gets local time zone information for the computer on which it is called, relative to universal time coordinated (utc). Utc is the mean solar time of the meridian of greenwich, england, used as the basis for calculating standard time throughout the worl...
Page 642
642 chapter 3: coldfusion functions gettoken description determines whether a token of the list in the delimiters parameter is present in a string. Returns the token found at position index of the string, as a string. If index is greater than the number of tokens in the string, returns an empty stri...
Page 643
Gettoken 643 #mystring# the output is as follows: four, ,five, nine,zero:; nine,ten:, eleven:;twelve:;thirteen, ,four the gettoken function recognizes explicit spaces, tabs, or newline characters as the parameter delimiters (to specify a space character, the code is chr(32) ; a tab character, chr(9)...
Page 644
644 chapter 3: coldfusion functions the following is a call against mystring2 : gettoken(mystring2, 2) is : #gettoken(mystring2, 2)# the output is as follows: gettoken(mystring2, 2) is : ,five,nine,zero:; the function finds the second delimiter, and returns the substring just before it that is betwe...
Page 645
Hash 645 hash description converts a variable-length string to a fixed-length string that can act as a “fingerprint” or unique identifier for the original string. It is not possible to convert the hash result back to the source string. Returns a string. Category conversion functions , security funct...
Page 646
646 chapter 3: coldfusion functions usage the result of this function is useful for comparison and validation. For example, you can store the hash of a password in a database without exposing the password. You can check the validity of the password by hashing the entered password and comparing the r...
Page 647
Hash 647 user id: password:.
Page 648
648 chapter 3: coldfusion functions hour description gets the current hour of the day. Returns ordinal value of the hour, in the range 0 - 23. Category date and time functions function syntax hour(date) see also datepart , minute , second parameters usage when passing a date/time value as a string, ...
Page 649
Htmlcodeformat 649 htmlcodeformat description replaces special characters in a string with their html-escaped equivalents and inserts and tags at the beginning and end of the string. Returns html-escaped string string, enclosed in and tags. Return characters are removed; line feed characters are pre...
Page 650
650 chapter 3: coldfusion functions example & this is another previous line was blank!!!"> #teststring# #htmlcodeformat(teststring)# #htmleditformat(teststring)#.
Page 651
Htmleditformat 651 htmleditformat description replaces special characters in a string with their html-escaped equivalents. Returns html-escaped string string. Return characters are removed; line feed characters are preserved. Characters with special meanings in html are converted to html character e...
Page 652
652 chapter 3: coldfusion functions the only difference between this function and htmlcodeformat is that htmlcodeformat surrounds the text in an html pre tag. Example & this is another previous line was blank!!!"> #teststring# #htmlcodeformat(teststring)# #htmleditformat(teststring)#.
Page 653
Iif 653 iif description evaluates a boolean conditional dynamic expression. Depending on whether the expression is true or false, dynamically evaluates one of two string expressions and returns the result. This function is convenient for incorporating a cfif tag in-line in html. For general conditio...
Page 654
654 chapter 3: coldfusion functions note: if you use number signs (#) in string_expression1 or string_expression2, coldfusion evaluates the part of the expression in number signs first. If you misuse the number signs, you can cause unexpected results from the iif function. For example, if you use nu...
Page 655
Iif 655 #iif( hour(now()) gte 12, de("it is afternoon or evening"), de("it is morning"))#.
Page 656
656 chapter 3: coldfusion functions incrementvalue description adds one to an integer. Returns the integer part of number, incremented by one. Category mathematical functions function syntax incrementvalue(number) see also decrementvalue parameters example returns the integer part of a number increm...
Page 657
Inputbasen 657 inputbasen description converts string, using the base specified by radix, to an integer. Returns a number in the range 2-36, as a string. Category mathematical functions function syntax inputbasen(string, radix) see also formatbasen parameters example formatbasen converts a number to...
Page 658
658 chapter 3: coldfusion functions insert description inserts a substring in a string after a specified character position. If position = 0 , prefixes the substring to the string. Returns a string. Category string functions function syntax insert(substring, string, position) see also removechars , ...
Page 659
Int 659 int description calculates the closest integer that is smaller than number. For example, it returns 3 for int(3.3) and for int(3.7) ; it returns -4 for int(-3.3) and for int(-3.7 ). Returns an integer, as a string. Category mathematical functions function syntax int(number) see also ceiling ...
Page 660
660 chapter 3: coldfusion functions isarray description determines whether a value is an array. Returns true, if value is an array, or a query column object. Category array functions , decision functions function syntax isarray(value [, number ]) see also array functions ; “modifying a coldfusion xm...
Page 661
Isauthenticated 661 isauthenticated description this function is obsolete. Use the newer security tools; see “conversion functions” on page 453 and chapter 16, “securing applications” in coldfusion mx developer’s guide. History coldfusion mx: this function is obsolete. It does not work in coldfusion...
Page 662
662 chapter 3: coldfusion functions isauthorized description this function is obsolete. Use the newer security tools; see “conversion functions” on page 453 and chapter 16, “securing applications” in coldfusion mx developer’s guide history coldfusion mx: this function is obsolete. It does not work i...
Page 663
Isbinary 663 isbinary description determines whether a value is stored as binary data. Returns true, if the value is binary; false, otherwise. Category decision functions function syntax isbinary(value) see also tobinary , tobase64 , isnumeric , yesnoformat parameters example the following string is...
Page 664
664 chapter 3: coldfusion functions.
Page 665
Isboolean 665 isboolean description determines whether a value can be converted to boolean returns true, if the parameter can be converted to boolean; false, otherwise. Category decision functions function syntax isboolean(value) see also isnumeric , isvalid , yesnoformat parameters example isboolea...
Page 666
666 chapter 3: coldfusion functions iscustomfunction description determines whether a name represents a custom function. Returns true, if name can be called as a custom function; false, otherwise. Category decision functions function syntax iscustomfunction(name) parameters usage the iscustomfunctio...
Page 667
Iscustomfunction 667 iscustomfunction(mytestcfcobject.Testfunc)> mytestcfcobject.Testfunc is a function. Iscustomfunction(mytestcfcobject.Testfunc)> mytestcfcobject.Testfunc is a function..
Page 668
668 chapter 3: coldfusion functions isdate description determines whether a string or java object can be converted to a date/time value. Returns true, if string can be converted to a date/time value; false, otherwise. Coldfusion converts the boolean return value to its string equivalent, "yes" or "n...
Page 669
Isdebugmode 669 isdebugmode description determines whether debugging output is enabled. Returns true, if debugging mode is set in the coldfusion administrator; false if debugging mode is disabled. Category decision functions function syntax isdebugmode() see also cfsetting description if debugging o...
Page 670
670 chapter 3: coldfusion functions isdefined description evaluates a string value to determine whether the variable named in it exists. This function is an alternative to the parameterexists function, which is deprecated. Returns true, if the variable is found, or, for a structure, if the specified...
Page 671
Isdefined 671 during the first time through this template, the variable "form.Mystring" has not yet been defined, so we do not try to evaluate it..
Page 672
672 chapter 3: coldfusion functions isk2serverabroker description this function is deprecated. Returns true, if k2broker is in configured with coldfusion; false, otherwise. Category decision functions , full-text search functions , query functions function syntax isk2serverabroker() see also getk2se...
Page 673
Isk2serverdoccountexceeded 673 isk2serverdoccountexceeded description this function is deprecated. Returns true, if the document count limit is exceeded; false, otherwise. Category decision functions , full-text search functions , query functions function syntax isk2serverdoccountexceeded() see also...
Page 674
674 chapter 3: coldfusion functions isk2serveronline description this function is deprecated because the k2server is always running when coldfusion is running. Returns true, if the k2server is available to perform a search; false, otherwise. Category decision functions , full-text search functions ,...
Page 675
Isleapyear 675 isleapyear description determines whether a year is a leap year. Returns true, if year is a leap year; false, otherwise. Category date and time functions , decision functions function syntax isleapyear(year) see also daysinyear parameters example isleapyear(form.Thetestvalue)> year le...
Page 676
676 chapter 3: coldfusion functions isnumeric description determines whether a string can be converted to a numeric value. Supports numbers in u.S. Number format. For other number support, use lsisnumeric . Returns true, if string can be converted to a number; false, otherwise. Category decision fun...
Page 677
Isnumericdate 677 isnumericdate description evaluates whether a real number is a valid representation of a date (date/time object). Returns true, if the parameter represents a valid date/time object; false, otherwise. Category date and time functions , decision functions function syntax isnumericdat...
Page 678
678 chapter 3: coldfusion functions.
Page 679
Isobject 679 isobject description determines whether a value is an object. Returns true, if the value represents a coldfusion object. False if the value is any other type of data, such as an integer, string, date, or struct. Category decision functions function syntax isobject(value) see also isdate...
Page 680
680 chapter 3: coldfusion functions returnvariable="mycolor"> the value of mycolor = #mycolor#.
Page 681
Isprotected 681 isprotected description this function is obsolete. Use the newer security tools; see “conversion functions” on page 453 and chapter 16, “securing applications,” in coldfusion mx developer’s guide history coldfusion mx: this function is obsolete. It does not work in coldfusion mx and ...
Page 682
682 chapter 3: coldfusion functions isquery description determines whether value is a query. Returns true, if value is a query. Category decision functions , query functions function syntax isquery(value) see also queryaddrow parameters example before the query is run, the value of getemployees is #...
Page 683
Issimplevalue 683 issimplevalue description determines the type of a value. Returns true, if value is a string, number, boolean, or date/time value; false, otherwise. Category decision functions function syntax issimplevalue(value) see also isvalid parameters example before the query is run, the val...
Page 684
684 chapter 3: coldfusion functions issoaprequest description determines whether a cfc is being called as a web service. Returns true if cfc is being called as a web service; false, otherwise. Category xml functions history coldfusion mx 7: added this function. Function syntax issoaprequest() see al...
Page 685
Issoaprequest 685 "true")> as xml: " & xmlusername> "true")> as xml: " & xmlpassword> "authorized value", false)> "true")> as xml: " & xmlusername> "true")> as xml: " & xmlpassword> "authorized value", false)> "true")> as xml: " & xmlpassword> "authorized value", false)> "authorized value", false)>.
Page 686
686 chapter 3: coldfusion functions isstruct description determines whether a variable is a structure. Returns true, if variable is a coldfusion structure or is a java object that implements the java.Lang.Map interface. The return value is false if the object in variable is a user-defined function (...
Page 687
Isstruct 687 ) employee add complete --->.
Page 688
688 chapter 3: coldfusion functions isuserinrole description determines whether an authenticated user belongs to the specified role. Returns true, if the authenticated user, belongs to the specified role; false, otherwise. Category security functions , decision functions function syntax isuserinrole...
Page 689
Isvalid 689 isvalid description tests whether a value meets a validation or data type rule. Returns true, if the value conforms to the rule; false, otherwise. Category decision functions function syntax isvalid(type, value) isvalid("range", value, min, max) isvalid("regex" or "regular_expression", v...
Page 690
690 chapter 3: coldfusion functions parameters usage the isvalid function lets you assure that validation is performed on the server. You can use the cfparam tag to perform equivalent validation. Parameter description type the valid format for the data; one of the following. For detailed information...
Page 691
Isvalid 691 example the following example checks whether a user has submitted a numeric id and a valid email address and phone number. If any of the submitted values does not meet the validation test, it displays an error message. And isvalid("telephone", form.Phoneno)> the email address and phone n...
Page 692
692 chapter 3: coldfusion functions iswddx description determines whether a value is a well-formed wddx packet. Returns true, if the value is a well-formed wddx packet; false, otherwise. Category decision functions , xml functions syntax iswddx(value) see also “using wddx” in chapter 35, “using xml ...
Page 693
Iswddx 693 " > #packet# iswddx() returns #iswddx(packet)#.
Page 694
694 chapter 3: coldfusion functions isxml description determines whether a string is well-formed xml text. Returns true, if the function parameter is a string that contains well-formed xml text; false, otherwise. Category decision functions , xml functions function syntax isxml(value) see also isxml...
Page 695
Isxml 695 1 15.95 ' > xmlstring1 contains the following text: #htmlcodeformat(xmlstring1)# is it well formed xml text? #isxml(xmlstring1)# xmlstring2 contains the following text: #htmlcodeformat(xmlstring2)# is it well formed xml text? #isxml(xmlstring2)#.
Page 696
696 chapter 3: coldfusion functions isxmlattribute description determines whether the function parameter is an xml document object model (dom) attribute node. Returns true, if the function argument is an xml attribute node; false, otherwise. Category decision functions , xml functions function synta...
Page 697
Isxmlattribute 697 1 15.95 node.Xmlobject.Order.Xmlattributes.Id: #isxmlattribute(xmlobject.Order.Xmlattributes.Id)# xmlobject.Order.Items: #isxmlattribute(xmlobject.Order.Items)# lastnames[1] returned by xmlsearch: #isxmlattribute(lastnames[1])#.
Page 698
698 chapter 3: coldfusion functions isxmldoc description determines whether the function parameter is a coldfusion xml document object. Returns true, if the function argument is an xml document object; false, otherwise. Category decision functions , xml functions function syntax isxmldoc(value) see ...
Page 699
Isxmlelem 699 isxmlelem description determines whether the function parameter is an xml document object element. Returns true, if the function argument is an xml document object element; false, otherwise. Category decision functions , xml functions function syntax isxmlelem(value) see also isxml , i...
Page 700
700 chapter 3: coldfusion functions isxmlnode description determines whether the function parameter is an xml document object node. Returns true, if the function argument is an xml document object node, including an element; false, otherwise. Category decision functions , xml functions function synt...
Page 701
Isxmlnode 701 1 15.95 xmlobject: #isxmlnode(xmlobject)# xmlobject.Order.Items: #isxmlnode(xmlobject.Order.Items)# xmlobject.Order.Xmlattributes.Id: #isxmlnode(xmlobject.Order.Xmlattributes.Id)# lastnames[1] returned by xmlsearch: #isxmlnode(lastnames[1])#.
Page 702
702 chapter 3: coldfusion functions isxmlroot description determines whether the function parameter is the root element of an xml document object. Returns true, if the function argument is the root object of an xml document object; false, otherwise. Category decision functions , xml functions functi...
Page 703
Javacast 703 javacast description converts the data type of a coldfusion variable to pass as an argument to an overloaded method of a java object. Use only for scalar and string arguments. Returns the variable, as type type. Category string functions function syntax javacast(type, variable) see also...
Page 704
704 chapter 3: coldfusion functions because there is not a one-to-one correspondence between internally stored coldfusion types and java scalar types, some conversions cannot be performed. Example the method foomethod in the class fooclass takes one overloaded argument. The fooclass class is defined...
Page 705
Jsstringformat 705 jsstringformat description escapes special javascript characters, such as single-quotation mark, double-quotation mark, and newline. Returns a string that is safe to use with javascript. Category string functions function syntax jsstringformat(string) parameters usage escapes spec...
Page 706: Chapter 3
706 chapter 3: coldfusion functions lcase description converts the alphabetic characters in a string to lowercase. Returns a string, converted to lowercase. Category string functions function syntax lcase(string) see also ucase parameters example your text, #form.Sampletext#, returned in lowercase i...
Page 707
Left 707 left description returns the leftmost count characters in a string. Returns string; the first count characters in the string parameter. Category string functions function syntax left(string, count) see also right , mid , len parameters example your string #form.Mytext# only has #len(form.My...
Page 708
708 chapter 3: coldfusion functions 1 3 5 7 9.
Page 709
Len 709 len description determines the length of a string or binary object. Returns number; length of a string or a binary object. Category string functions function syntax len(string or binary object) see also tobinary , left , right , mid history coldfusion mx: changed unicode support: coldfusion ...
Page 710
710 chapter 3: coldfusion functions listappend description concatenates a list or element to a list. Returns a copy of the list , with value appended. If delimiter = "" , returns a copy of the list, unchanged. Category list functions function syntax listappend(list, value [, delimiters ]) see also l...
Page 711
Listappend 711 the original list: #temp# ....
Page 712
712 chapter 3: coldfusion functions listchangedelims description changes a list delimiter. Returns a copy of the list, with each delimiter character replaced by new_delimiter. Category list functions function syntax listchangedelims(list, new_delimiter [, delimiters ]) see also listfirst , listquali...
Page 713
Listcontains 713 listcontains description determines the index of the first list element that contains a specified substring. Returns index of the first list element that contains substring. If not found, returns zero. Category list functions function syntax listcontains(list, substring [, delimiter...
Page 714
714 chapter 3: coldfusion functions as "two", both listcontains and listfind find it, in the second element: listcontains: the string "two" is in element #listcontains(alist, "two")# of the list. Listfind: the string "two" is in element #listfind(alist, "two")# of the list..
Page 715
Listcontainsnocase 715 listcontainsnocase description determines the index of the first list element that contains a specified substring. Returns index of the first list element that contains substring, regardless of case. If not found, returns zero. Category list functions function syntax listconta...
Page 716
716 chapter 3: coldfusion functions listdeleteat description deletes an element from a list. Returns a copy of the list, without the specified element. Category list functions function syntax listdeleteat(list, position [, delimiters ]) see also listgetat , listsetat , listlen ; “lists” in chapter 3...
Page 717
Listdeleteat 717 listdeleteat(temp, "3")> the changed list: #temp2# this list element:#deleted_element# is no longer present at position three of the list..
Page 718
718 chapter 3: coldfusion functions listfind description determines the index of the first list element in which a specified value occurs. Case-sensitive. Returns index of the first list element that contains value, with matching case. If not found, returns zero. The search is case-sensitive. Catego...
Page 719
Listfind 719 select firstname, rtrim(lastname) as lname, phone, department from employees listfind(mylist, form.Mystring)> employee #listgetat(valuelist(searchemplastname.Firstname), temp)# #listgetat(valuelist(searchemplastname.Lname), temp)#, of the #listgetat(valuelist(searchemplastname.Departmen...
Page 720
720 chapter 3: coldfusion functions listfindnocase description determines the index of the first list element in which a specified value occurs. Returns index of the first list element that contains value. If not found, returns zero. The search is case- insensitive. Category list functions function ...
Page 721
Listfindnocase 721 select firstname, rtrim(lastname) as lname, phone, department from employees employee #listgetat(valuelist(searchemplastname.Firstname), temp)# #listgetat(valuelist(searchemplastname.Lname), temp)#, of the #listgetat(valuelist(searchemplastname.Department), temp)# department, can ...
Page 722
722 chapter 3: coldfusion functions listfirst description gets the first element of a list. Returns the first element of a list. If the list is empty, returns an empty string. Category list functions function syntax listfirst(list [, delimiters ]) see also listgetat , listlast , listqualify ; “lists...
Page 723
Listgetat 723 listgetat description gets a list element at a specified position. Returns index of the list element at position position. Category list functions function syntax listgetat(list, position [, delimiters ]) see also listfirst , listlast , listqualify , listsetat ; “lists” in chapter 3, “...
Page 724
724 chapter 3: coldfusion functions #listlen(temp)# users. Username #counter#: #listgetat(temp, counter)#.
Page 725
Listinsertat 725 listinsertat description inserts an element in a list. Returns a copy of the list , with value inserted at the specified position. Category list functions function syntax listinsertat(list, position, value [, delimiters ]) see also listdeleteat , listappend , listprepend , listsetat...
Page 726
726 chapter 3: coldfusion functions listlast description gets the last element of a list. Returns the last element of the list. Category list functions function syntax listlast(list [, delimiters ]) see also listgetat , listfirst ; “lists” in chapter 3, “using coldfusion variables,” in coldfusion mx...
Page 727
Listlast 727 before editing the list, it is: #valuelist(getmessageuser.Username)#. (users who posted more than once are listed more than once.) the first user in the list is: #listfirst(temp)# the rest of the list is: #listrest(temp)#. (users who posted more than once are listed more than once.) the...
Page 728
728 chapter 3: coldfusion functions listlen description determines the number of elements in a list. Integer; the number of elements in a list. Category list functions function syntax listlen(list [, delimiters ]) see also listappend , listdeleteat , listinsertat , listprepend ; “lists” in chapter 3...
Page 729
Listlen 729 #listlen(temp)# users. Username #counter#: #listgetat(temp, counter)#.
Page 730
730 chapter 3: coldfusion functions listprepend description inserts an element at the beginning of a list. Returns a copy of the list , with value inserted at the first position. Category list functions function syntax listprepend(list, value [, delimiters ]) see also listappend , listinsertat , lis...
Page 731
Listqualify 731 listqualify description inserts a string at the beginning and end of list elements. Returns a copy of the list, with qualifier before and after the specified element(s). Category list functions function syntax listqualify(list, qualifier [, delimiters ] [, elements ]) see also “lists...
Page 732
732 chapter 3: coldfusion functions the contents of the unqualified list are as follows: #mylist# listqualify(mylist,"'",",","char")> the contents of the qualified list are as follows: #qualifiedlist1# listqualify(mylist,""",",","char")> the contents of the second qualified list are: #qualifiedlist2...
Page 733
Listrest 733 listrest description gets a list, without its first element. Returns a copy of list, without the first element. If list has one element, returns an empty list. Category list functions function syntax listrest(list [, delimiters ]) see also listfirst , listgetat , listlast ; “lists” in c...
Page 734
734 chapter 3: coldfusion functions listsetat description replaces the contents of a list element. Returns a copy of a list, with a new value assigned to the element at a specified position. Category list functions function syntax listsetat(list, position, value [, delimiters ]) see also listdeletea...
Page 735
Listsetat 735 subjects posted in messages. Listsetat(temp, 2, "i changed this subject", ",")> (#counter#) subject: #listgetat(temptoo, counter)# note that element 2, "#changedelement#", has been altered to "i changed this subject" using listsetat..
Page 736
736 chapter 3: coldfusion functions listsort description sorts list elements according to a sort type and sort order. Returns a copy of a list, sorted. Category list functions function syntax listsort(list, sort_type [, sort_order] [, delimiters ]) see also “lists” in chapter 3, “using coldfusion va...
Page 737
Listsort 737 usage coldfusion ignores empty list elements; thus, the list "a,b,c,,,d" has four elements. Example select username, subject, posted from messages here is the unsorted list. #mylist# here is the list sorted alphabetically: #sortedlist# here is a numeric list that is to be sorted in desc...
Page 738
738 chapter 3: coldfusion functions listtoarray description copies the elements of a list to an array. Returns an array category array functions , conversion functions , list functions function syntax listtoarray(list [, delimiters ]) see also arraytolist ; chapter 5, “using arrays and structures,” ...
Page 739
Listvaluecount 739 listvaluecount description counts instances of a specified value in a list. The search is case-sensitive. Returns the number of instances of value in the list. Category list functions , string functions function syntax listvaluecount(list, value [, delimiters ]) see also listvalue...
Page 740
740 chapter 3: coldfusion functions sales h3> there is only one person in #form.Departmentname#. There is only one person in #form.Departmentname#. There are #numberindepartment# people in #form.Departmentname#. There are #numberindepartment# people in #form.Departmentname#..
Page 741
Listvaluecountnocase 741 listvaluecountnocase description counts instances of a specified value in a list. The search is case-insensitive. Returns the number of instances of value in the list. Category list functions function syntax listvaluecountnocase(list, value [, delimiters ]) see also listvalu...
Page 742
742 chapter 3: coldfusion functions sales form.Departmentname)> there are no employees in #form.Departmentname# form.Departmentname)> cfoutput> there is only one person in #form.Departmentname#. There is only one person in #form.Departmentname#. There are #numberindepartment# people in #form.Departm...
Page 743
Ljustify 743 ljustify description left justifies characters in a string of a specified length. Returns a copy of a string, left-justified. Category display and formatting functions , string functions function syntax ljustify(string, length) see also cjustify , rjustify parameters example ljustify(fo...
Page 744
744 chapter 3: coldfusion functions log description calculates the natural logarithm of a number. Natural logarithms are based on the constant e (2.71828182845904). Returns the natural logarithm of a number. Category mathematical functions function syntax log(number) see also exp , log10 parameters ...
Page 745
Log10 745 log10 description calculates the logarithm of number, to base 10. Returns number; the logarithm of number, to base 10. Category mathematical functions function syntax log10(number) see also exp , log parameters example your number, #form.Number# #form.Number# raised to the e power: #exp(fo...
Page 746
746 chapter 3: coldfusion functions lscurrencyformat description formats a number in a locale-specific currency format. For countries that use the euro, the result depends on the jvm. Returns a formatted currency value. Category display and formatting functions , international functions function syn...
Page 747
Lscurrencyformat 747 currency output the following table shows sample currency output. For locales that use euro, the local and international columns contains two entries. The first is entry is the result with a sun the 1.4.1- compliant jvm, the second entry is the result with a 1.3.1-compliant jvm....
Page 748
748 chapter 3: coldfusion functions note: coldfusion maps spanish (modern) to the spanish (standard) format. To set the default display format of date, time, number, and currency values, use the setlocale function. Example lscurrencyformat returns a currency value using the locale convention. Defaul...
Page 749
Lsdateformat 749 lsdateformat description formats the date part of a date/time value in a locale-specific format. Returns a formatted date/time value. If no mask is specified, the value is formatted according to the locale setting of the client computer. Category date and time functions , display an...
Page 750
750 chapter 3: coldfusion functions parameters usage this function uses java standard locale formatting rules on all platforms. When passing date/time value as a string, enclose it in quotation marks. Otherwise, it is interpreted as a number representation of a date/time object. To calculate a diffe...
Page 751
Lsdateformat 751.
Page 752
752 chapter 3: coldfusion functions lseurocurrencyformat description formats a number in a locale-specific currency format. Returns a formatted currency value. For countries in the euro currency zone, the function uses the locale’s rule’s for formatting currency in euros. Category display and format...
Page 753
Lseurocurrencyformat 753 currency output the following table shows examples of currency output: note: coldfusion uses the spanish (standard) formats for spanish (modern) and spanish (standard). Locale type = local type = international type = none chinese (china) ¥100,000.00 cny100,000.00 100,000.00 ...
Page 754
754 chapter 3: coldfusion functions the following example shows how the function formats negative values. The format includes a negative sign before the value, or parentheses around the value, according to the formatting rules of the current locale. Example lseurocurrencyformat returns a currency va...
Page 755
Lsiscurrency 755 lsiscurrency description determines whether a string is a valid representation of a currency amount in the current locale. Returns true, if the parameter is formatted as a valid currency amount, including the appropriate currency indicator. The return value is true for amounts in th...
Page 756
756 chapter 3: coldfusion functions is the value "#form.Myvalue#" a proper currency value for #getlocale()#? Answer: #lsiscurrency(form.Myvalue)# select a locale for which you would like to check a currency value:.
Page 757
Lsisdate 757 lsisdate description determines whether a string is a valid representation of a date/time value in the current locale. Returns true, if the string can be formatted as a date/time value in the current locale; false, otherwise. Category date and time functions , display and formatting fun...
Page 758
758 chapter 3: coldfusion functions is the value "#form.Myvalue#" a proper date value for #getlocale()#? Answer: #lsisdate(form.Myvalue)# select a locale for which you would like to check a date value:.
Page 759
Lsisnumeric 759 lsisnumeric description determines whether a string is a valid representation of a number in the current locale. Returns true, if the string represents a number the current locale; false, otherwise. Category decision functions , international functions , string functions function syn...
Page 760
760 chapter 3: coldfusion functions lsnumberformat description formats a number in a locale-specific format. Returns a formatted number. • if no mask is specified, it returns the number formatted as an integer • if no mask is specified, truncates the decimal part; for example, it truncates 34.57 to ...
Page 761
Lsnumberformat 761 note: if you do not specify a sign for the mask, positive and negative numbers do not align in columns. To put a plus sign or space before positive numbers and a minus sign before negative numbers, use the plus or hyphen mask character, respectively. Usage this function uses java ...
Page 762
762 chapter 3: coldfusion functions an underscore determines whether the code is placed in the far or near position. Most code characters’ effect is determined by the field in which they are located. This example shows how to specify where to put parentheses to display negative numbers: to set the d...
Page 763
Lsparsecurrency 763 lsparsecurrency description converts a locale-specific currency string into a formatted number. Attempts conversion by comparing the string with each the three supported currency formats (none, local, international) and using the first that matches. Returns a formatted number (st...
Page 764
764 chapter 3: coldfusion functions for a list of the locale-specific formats used to parse the currency, see lscurrencyformat . Example lsparsecurrency coverts a locale-specific currency string to a number. Attempts conversion through each of the three default currency formats. Index = "locale" del...
Page 765
Lsparsedatetime 765 lsparsedatetime description converts a string that is a valid date/time representation in the current locale into a date/time object. Returns a date/time object. Category date and time functions , display and formatting functions , international functions , string functions funct...
Page 766
766 chapter 3: coldfusion functions valid dates are in the range 100 ad–9999 ad. Two digit years in the range 00-29 are interpreted as being 2000-2029. Two digit years in the range 30-99 are interpreted as being 1930-1999 this function corrects for differences between the current time zone and any t...
Page 767
Lsparseeurocurrency 767 lsparseeurocurrency description formats a locale-specific currency string as a number. Attempts conversion through each of the default currency formats (none, local, international). Ensures correct handling of euro currency for euro zone countries. Returns a formatted number ...
Page 768
768 chapter 3: coldfusion functions current locale: #locale# value in local currency: #localcurrency# parsed using lsparseeurocurrency: #lsparseeurocurrency(localcurrency)# value with international currency formatting: #intlcurrency# parsed using lsparseeurocurrency: #lsparseeurocurrency(intlcurrenc...
Page 769
Lsparsenumber 769 lsparsenumber description converts a string that is a valid numeric representation in the current locale into a formatted number. Returns a formatted number that matches the value of the string. Category international functions , string functions function syntax lsparsenumber(strin...
Page 770
770 chapter 3: coldfusion functions #lsnumberformat(1234.5678, "+_________.___")# #lsnumberformat(1234.5678, "-_________.___")# the actual number: #lsparsenumber(lsnumberformat(1234.5678, "_________"))#.
Page 771
Lstimeformat 771 lstimeformat description formats the time part of a date/time string into a string in a locale-specific format. Returns a string representing the time value. Category date and time functions , display and formatting functions , international functions function syntax lstimeformat(ti...
Page 772
772 chapter 3: coldfusion functions parameters usage this function uses java standard locale formatting rules on all platforms. When passing date/time value as a string, enclose it in quotation marks. Otherwise, it is interpreted as a number representation of a date/time object. To calculate a diffe...
Page 773
Lstimeformat 773 #locale# #lstimeformat(now())# #lstimeformat(now(), ‘hh:mm:ss’)# #lstimeformat(now(), ‘hh:mm:sst’)# #lstimeformat(now(), ‘hh:mm:sstt’)# #lstimeformat(now(), ‘hh:mm:ss’)# #locale# #lstimeformat(now())# #lstimeformat(now(), ‘hh:mm:ss’)# #lstimeformat(now(), ‘hh:mm:sst’)# #lstimeformat...
Page 774
774 chapter 3: coldfusion functions ltrim description removes leading spaces from a string. Returns a copy of the string, without leading spaces. Category display and formatting functions , string functions function syntax ltrim(string) see also rtrim , tobase64 parameters example your string:"#form...
Page 775
Max 775 max description determines the greater of two numbers. Returns the greater of two numbers. Category mathematical functions function syntax max(number1, number2) see also min parameters example the maximum of the two numbers is #max(form.Mynum1, form.Mynum2)# the minimum of the two numbers is...
Page 776
776 chapter 3: coldfusion functions mid description extracts a substring from a string. Returns a string; the set of characters from string, beginning at start, of length count. Category string functions function syntax mid(string, start, count) see also left , len , right parameters example your st...
Page 777
Mid 777 type in some text enter a starting position (from the beginning of the entered text) how many characters do you want to show? 1 3 5 7 9.
Page 778
778 chapter 3: coldfusion functions min description determines the lesser of two numbers. Returns the lesser of two numbers. Category mathematical functions function syntax min(number1, number2) see also max parameters example the maximum of the two numbers is #max(form.Mynum1, form.Mynum2)# the min...
Page 779
Minute 779 minute description extracts the minute value from a date/time object. Returns the ordinal value of the minute, in the range 0–59. Category date and time functions function syntax minute(date) see also datepart , hash , second parameters usage when passing a date/time value as a string, yo...
Page 780
780 chapter 3: coldfusion functions month description extracts the month value from a date/time object. Returns the ordinal value of the month, in the range 1 (january) – 12 (december). Category date and time functions function syntax month(date) see also datepart , monthasstring , quarter parameter...
Page 781
Monthasstring 781 monthasstring description determines the name of the month that corresponds to month_number. Returns a string; the name of the specified month, in the current locale. Category date and time functions , string functions function syntax monthasstring(month_number) see also datepart ,...
Page 782
782 chapter 3: coldfusion functions now description gets the current date and time of the computer running the coldfusion server. The return value can be passed as a parameter to date functions such as daysinyear or firstdayofmonth . Returns a date/time object; the current date and time of the compu...
Page 783
Numberformat 783 numberformat description creates a custom-formatted number value. Supports the numeric formatting used in the u.S. For international number formatting, see lsnumberformat . Returns a formatted number value: • if no mask is specified, returns the value as an integer with a thousands ...
Page 784
784 chapter 3: coldfusion functions note: if you do not specify a sign for the mask, positive and negative numbers do not align in columns. To put a plus sign or space before positive numbers and a minus sign before negative numbers, use the plus or minus sign, respectively. Usage this function uses...
Page 785
Numberformat 785 when converting from string to double, to prevent rounding errors, this function adds a rounding factor of 1.5543122344752e-014 to the converted number. For example, without adding the rounding factor, converting the string value 1.275 to double with two digits of precision results ...
Page 786
786 chapter 3: coldfusion functions paragraphformat description replaces characters in a string: • single newline characters (cr/lf sequences) with spaces • double newline characters with html paragraph tags ( ) returns a copy of the string, with characters converted. Category display and formatting...
Page 787
Parameterexists 787 parameterexists description this function is deprecated. Use the isdefined function. Determines whether a parameter exists. Coldfusion does not evaluate the argument. History coldfusion mx: deprecated this function. It might not work, and might cause an error, in later releases..
Page 788
788 chapter 3: coldfusion functions parsedatetime description parses a date/time string according to the english (u.S.) locale conventions. (to format a date/ time string for other locales, use the lsparsedatetime function.) returns a date/time object category date and time functions , display and f...
Page 789
Parsedatetime 789 valid date enter an expression, and discover if it can be evaluated to a date value. #timeformat(now())#">.
Page 790
790 chapter 3: coldfusion functions pi description gets the mathematical constant π , accurate to 15 digits. Returns the number 3.14159265358979. Category mathematical functions function syntax pi() see also asin , cos , sin , tan example the pi function returns the number #numberformat(pi(), "_.___...
Page 791
Preservesinglequotes 791 preservesinglequotes description prevents coldfusion from automatically escaping single-quotation mark characters that are contained in a variable. Coldfusion does not evaluate the argument. Returns (none) category other functions function syntax preservesinglequotes(variabl...
Page 792
792 chapter 3: coldfusion functions you code this function correctly as follows: (#preservesinglequotes(list0)#)"> this function ensures that coldfusion evaluates the code as follows: '1', '2', '3' example preservesinglequotes examplethis is a useful function for creating lists of information to ret...
Page 793
Quarter 793 quarter description calculates the quarter of the year in which a date falls. Returns an integer, 1–4. Category date and time functions function syntax quarter(date) see also datepart , month parameters usage when passing a date/time value as a string, you must enclose it in quotation ma...
Page 794
794 chapter 3: coldfusion functions queryaddcolumn description adds a column to a query and populates its rows with the contents of a one-dimensional array. Pads query columns, if necessary, to ensure that all columns have the same number of rows. Returns the number of the column that was added. Cat...
Page 795
Queryaddcolumn 795 usage you can add columns to query objects, such as queries retrieved with the cfquery tag or queries created with the querynew function. You cannot use the queryaddcolumn function on a cached query. This function is useful for generating a query object from the arrays of output p...
Page 796
796 chapter 3: coldfusion functions.
Page 797
Queryaddrow 797 queryaddrow description adds a specified number of empty rows to a query. Returns the number of rows in the query category query functions function syntax queryaddrow(query [, number ]) see also queryaddcolumn , queryaddrow , querysetcell , querynew ; “creating a record set with a fu...
Page 798
798 chapter 3: coldfusion functions querynew description creates an empty query (query object). Returns an empty query with a set of named columns, or an empty query. Category query functions function syntax querynew(columnlist [, columntypelist]) history coldfusion mx 7: added columntypelist parame...
Page 799
Querynew 799 example the following example uses the querynew function to create an empty query with three columns. It populates two rows of the query and displays the contents of the query object and its metadata. Applications", 2)> the query object contents applications", 2)> #name# #time# #advance...
Page 800
800 chapter 3: coldfusion functions querysetcell description sets a cell to a value. If no row number is specified, the cell on the last row is set. Returns true, if successful; false, otherwise. Category query functions function syntax querysetcell(query, column_name, value [, row_number ]) see als...
Page 801
Quotedvaluelist 801 quotedvaluelist description gets the values of each record returned from an executed query. Coldfusion does not evaluate the arguments. Returns a delimited list of the values of each record returned from an executed query. Each value is enclosed in single-quotation marks. Categor...
Page 802
802 chapter 3: coldfusion functions rand description generates a pseudo-random number. Returns a pseudo-random decimal number, in the range 0 – 1. Category mathematical functions , security functions function syntax rand([algorithm]) history coldfusion mx 7: added the algorithm parameter. See also r...
Page 803
Randomize 803 randomize description seeds the pseudo-random number generator with an integer number, ensuring repeatable number patterns. Returns a pseudo-random decimal number, in the range 0–1. Category mathematical functions , security functions function syntax randomize(number[, algorithm]) hist...
Page 804
804 chapter 3: coldfusion functions example the following example calls the randomize function to seed the random number generator and generates 10 random numbers. To show the effect of the seed, submit the form with the same value multiple times. Seed value is #form.Myrandomint# random number retur...
Page 805
Randrange 805 randrange description generates a pseudo-random integer in the range between two specified numbers. Returns a pseudo-random integer. Category mathematical functions , security functions function syntax randrange(number1, number2[, algorithm]) history coldfusion mx 7: added the algorith...
Page 806
806 chapter 3: coldfusion functions example the following example contains a form that requires random number range values, and lets you optionally specify a random number seed value. It uses cfform controls and attributes to specify a default range, ensure that the range fields have values, and val...
Page 807
Refind 807 refind description uses a regular expression (re) to search a string for a pattern. The search is case sensitive. For more information on regular expressions, including escape sequences, anchors, and modifiers, see chapter 7, “using regular expressions in functions,” in coldfusion mx deve...
Page 808
808 chapter 3: coldfusion functions usage this function finds the first occurrence of a regular expression in a string. To find the second and subsequent instances of the expression or of subexpressions in it, you call this function more than once, each time with a different start position. To deter...
Page 809
Refind 809 the first call to refind to search this string is: refind("[a-za-z]+",teststring,1,"true") this function returns a structure that contains two arrays: pos and len. To create this structure you can use a cfset statement, for example: the number of elements in each array: #arraylen(st.Pos)#...
Page 810
810 chapter 3: coldfusion functions refindnocase description uses a regular expression (re) to search a string for a pattern, starting from a specified position. The search is case-insensitive. For more information on regular expressions, including escape sequences, anchors, and modifiers, see chapt...
Page 811
Refindnocase 811 usage this function finds the first occurrence of a regular expression in a string. To find the second and subsequent instances of the expression or of subexpressions in it, you call this function more than once, each time with a different start position. To determine the next start...
Page 812
812 chapter 3: coldfusion functions the first call to refindnocase to search this string is: refindnocase("[[:alpha:]]+",teststring,1,"true") this function returns a structure that contains two arrays: pos and len. To create this structure you can use a cfset statement, for example: the number of el...
Page 813
Releasecomobject 813 releasecomobject description releases a com object and frees up resources that it used. Returns nothing. Category extensibility functions function syntax releasecomobject(objectname) see also createobject , cfobject history coldfusion mx 6.1: added this function. Parameters usag...
Page 814
814 chapter 3: coldfusion functions removechars description removes characters from a string. Returns a copy of the string, with count characters removed from the specified start position. If no characters are found, returns zero. Category string functions function syntax removechars(string, start, ...
Page 815
Repeatstring 815 repeatstring description creates a string that contains a specified number of repetitions of the specified string. Returns a string. Category string functions function syntax repeatstring(string, count) see also cjustify , ljustify , rjustify parameters example repeatstring returns ...
Page 816
816 chapter 3: coldfusion functions replace description replaces occurrences of substring1 in a string with substring2, in a specified scope. The search is case-sensitive. Returns the string, after making replacements. Category string functions function syntax replace(string, substring1, substring2 ...
Page 817
Replacelist 817 replacelist description replaces occurrences of the elements from a delimited list in a string with corresponding elements from another delimited list. The search is case-sensitive. Returns a copy of the string, after making replacements. Category list functions , string functions fu...
Page 818
818 chapter 3: coldfusion functions #replacelist(stringtoreplace,"dog,brown,fox,black", "cow,black,ferret,white")#.
Page 819
Replacenocase 819 replacenocase description replaces occurrences of substring1 with substring2, in the specified scope. The search is case- insensitive. Returns a copy of the string, after making replacements. Category string functions function syntax replacenocase(string, substring1, substring2 [, ...
Page 820
820 chapter 3: coldfusion functions rereplace description uses a regular expression (re) to search a string for a string pattern and replace it with another. The search is case-sensitive. Returns if the scope parameter is set to one , returns a string with the first occurrence of the regular express...
Page 821
Rereplace 821 usage for details on using regular expressions, see chapter 7, “using regular expressions in functions,” in coldfusion mx developer’s guide. Example the rereplace function returns string with a regular expression replaced with substring in the specified scope. Case-sensitive search. Re...
Page 822
822 chapter 3: coldfusion functions rereplacenocase description uses a regular expression to search a string for a string pattern and replace it with another. The search is case-insensitive. Returns • if scope = "one" : returns a string with the first occurrence of the regular expression replaced by...
Page 824
824 chapter 3: coldfusion functions reverse description reverses the order of items, such as the characters in a string, the digits in a number, or the elements in an array. Returns a copy of string, with the characters in reverse order. Category string functions function syntax reverse(string) see ...
Page 825
Right 825 right description gets a specified number of characters from a string, beginning at the right. Returns the specified number of characters from the end (or right side) of the specified string. Returns • if the length of the string is greater than or equal to count , the rightmost count char...
Page 826
826 chapter 3: coldfusion functions please enter a string of more than 0 (zero) characters. Type in some text how many characters from the right do you want to show? 1 3 5 7 9.
Page 827
Rjustify 827 rjustify description right justifies characters of a string. Returns a copy of a string, right-justified in the specified field length. Category display and formatting functions , string functions function syntax rjustify(string, length) see also cjustify , ljustify parameters example r...
Page 828
828 chapter 3: coldfusion functions round description rounds a number to the closest integer that is larger than the input parameter. Returns an integer. Category mathematical functions function syntax round(number) see also ceiling , fix , int parameters usage use this function to round a number. T...
Page 829
Rtrim 829 rtrim description removes spaces from the end of a string. Returns a copy of string, after removing trailing spaces. Category string functions function syntax rtrim(string) see also ltrim , trim parameters example your string:"#form.Mytext#" your string:"#rtrim(form.Mytext)#" (right trimme...
Page 830
830 chapter 3: coldfusion functions second description extracts the ordinal for the second from a date/time object. Returns an integer in the range 0–59. Category date and time functions function syntax second(date) see also datepart , hash , minute parameters usage when passing a date/time object a...
Page 831
Sendgatewaymessage 831 sendgatewaymessage description sends an outgoing message through a coldfusion mx event gateway. Returns string. The value returned depends on the gateway type. Category extensibility functions function syntax sendgatewaymessage(gatewayid, data) see also getgatewayhelper ; “im ...
Page 832
832 chapter 3: coldfusion functions example the following example uses an instance of the cfml gateway to log messages asynchronously to a file. To use this example, you must configure an instance of the cfml gateway with the name “asynch logger” in the coldfusion mx administrator. This gateway inst...
Page 833
Setencoding 833 setencoding description sets the character encoding (character set) of form and url scope variable values; used when the character encoding of the input to a form, or the character encoding of a url, is not in utf-8 encoding. Returns none category international functions , system fun...
Page 834
834 chapter 3: coldfusion functions usage use this function when the character encoding of the input to a form or the character encoding of a url is not in utf-8 encoding. For example, traditional chinese characters are often in big5 encoding. This function resets url and form variables, so you shou...
Page 835
Setlocale 835 setlocale description sets the country/language locale for coldfusion processing and the page returned to the client. The locale value determines the default format of date, time, number, and currency values, according to language and regional conventions. Returns the locale value prio...
Page 836
836 chapter 3: coldfusion functions coldfusion determines the locale value as follows: • by default, coldfusion uses the jvm locale, and the default jvm locale is the operating system locale. You can set jvm locale value explicitly in coldfusion mx in the coldfusion administrator java and jvm settin...
Page 837
Setprofilestring 837 setprofilestring description sets the value of a profile entry in an initialization file. Returns an empty string, upon successful execution; otherwise, an error message. Category system functions function syntax setprofilestring(inipath, section, entry, value) see also getprofi...
Page 838
838 chapter 3: coldfusion functions timeout value should be greater than zero in order to provide time for user response. The timeout value in your initialization file is already #mytimeout#. Timeout is set to: #timeout#. Default directory is: #default#. Value = "c:\myboot.Ini">.
Page 839
Setvariable 839 setvariable description this function is no longer required in well-formed coldfusion pages. Sets a variable in the name parameter to the value of the value parameter. Returns the new value of the variable. Category dynamic evaluation functions function syntax setvariable(name, value...
Page 840
840 chapter 3: coldfusion functions your variable, #varname# the value of #varname# is #varnamevalue#.
Page 841
Sgn 841 sgn description determines the sign of a number. Returns • 1, if number is positive. • 0, if number is 0. • -1, if number is negative. Category mathematical functions function syntax sgn(number) see also abs parameters example sgn determines the sign of a number. Returns 1 if number is posit...
Page 842
842 chapter 3: coldfusion functions sin description calculates the sine of an angle that is entered in radians. Returns a number; the sine of the angle. Category mathematical functions function syntax sin(number) see also asin , cos , acos , tan , atn , pi parameters usage the range of the result is...
Page 843
Sin 843 enter an angle in degrees to get its sine:.
Page 844
844 chapter 3: coldfusion functions spanexcluding description gets characters from a string , from the beginning to a character that is in a specified set of characters. The search is case-sensitive. Returns a string; characters from string , from the beginning to a character that is in set. Categor...
Page 845
Spanincluding 845 spanincluding description gets characters from a string , from the beginning to a character that is not in a specified set of characters. The search is case-sensitive. Returns a string; characters from string , from the beginning to a character that is not in set. Category string f...
Page 846
846 chapter 3: coldfusion functions sqr description calculates the square root of a number. Returns number; square root of number. Category mathematical functions function syntax sqr(number) see also abs parameters usage the value in number must be greater than or equal to 0. Example returns the squ...
Page 847
Stripcr 847 stripcr description deletes return characters from a string. Returns a copy of string, after removing return characters. Category display and formatting functions , string functions function syntax stripcr(string) see also paragraphformat parameters usage useful for preformatted (between...
Page 848
848 chapter 3: coldfusion functions structappend description appends one structure to another. Returns true, upon successful completion; false, otherwise. Category structure functions function syntax structappend(struct1, struct2, overwriteflag) see also structure functions ; “modifying a coldfusion...
Page 849
Structappend 849 the person struct before the append call: #myitem# the person struct after the append call: #myitem#.
Page 850
850 chapter 3: coldfusion functions structclear description removes all data from a structure. Returns true, on successful execution; false, otherwise. Category structure functions function syntax structclear(structure) see also structure functions ; “modifying a coldfusion xml object” in chapter 35...
Page 851
Structclear 851 structinsert(employee, "lastname", form.Lastname); structinsert(employee, "email", form.Email); structinsert(employee, "phone", form.Phone); structinsert(employee, "department", form.Department); structclear(employee);.
Page 852
852 chapter 3: coldfusion functions structcopy description copies a structure. Copies top-level keys, values, and arrays in the structure by value; copies nested structures by reference. Returns a copy of a structure, with the same keys and values; if structure does not exist, throws an exception. C...
Page 853
Structcopy 853 the following table shows how variables are assigned: example // this script creates a structure that structcopy copies by value. // create elements. S = structnew(); s.Array = arraynew(2); // assign simple values to original top-level structure fields. S.Number = 99; s.String = "hell...
Page 854
854 chapter 3: coldfusion functions modified original values // simple values s.Number = #s.Number# s.String = #s.String# // array value s.Array[1][1] = #s.Array[1][1]# s.Array[1][2] = #s.Array[1][2]# copied structure values should be the same as the original. // simple values copied.Number = #copie...
Page 855
Structcopy 855 s.Nested.Number = 100; s.Nested.String = "hello tommy (modified)"; s.Nested.Array[1][1] = "one one (modified)"; s.Nested.Array[1][2] = "one two (modified)"; modified original values // simple values s.Nested.Number = #s.Nested.Number# s.Nested.String = #s.Nested.String# // array value...
Page 856
856 chapter 3: coldfusion functions structcount description counts the keys in a structure. Returns a number; if structure does not exist, throws an exception. Category structure functions function syntax structcount(structure) see also structure functions ; “modifying a coldfusion xml object” in ch...
Page 857
Structcount 857 employee add complete #structcount(attributes.Empinfo)# columns added. --->.
Page 858
858 chapter 3: coldfusion functions structdelete description removes an element from a structure. Returns boolean value. The value depends on the indicatenotexisting parameter value. Category structure functions function syntax structdelete(structure, key [, indicatenotexisting ]) see also structure...
Page 859
Structdelete 859 structinsert(employee, "phone", phone); structinsert(employee, "department", department); before deletion, employee structure looks like this: did i delete the field "#form.Field#"? The code indicates: #rc# the structure now looks like this: select the field to be deleted: first nam...
Page 860
860 chapter 3: coldfusion functions structfind description determines the value associated with a key in a structure. Returns the value associated with a key in a structure; if structure does not exist, throws an exception. Category structure functions function syntax structfind(structure, key) see ...
Page 861
Structfind 861 employee add complete --->.
Page 862
862 chapter 3: coldfusion functions structfindkey description searches recursively through a substructure of nested arrays, structures, and other elements, for structures whose values match the search key in the value parameter. Returns an array that contains structures with values that match value....
Page 863
Structfindvalue 863 structfindvalue description searches recursively through a substructure of nested arrays, structures, and other elements for structures with values that match the search key in the value parameter. Returns an array that contains structures with values that match the search key va...
Page 864
864 chapter 3: coldfusion functions structget description gets a structure(s) from a specified path. Returns an alias to the variable in the pathdesired parameter. If necessary, structget creates structures or arrays to make pathdesired a valid variable "path." category structure functions function ...
Page 865
Structget 865 dog.Myscope.Test.Foo is not defined #dog.Myscope.Test.Foo# #request.Myscope[1].Test.Foo# #request.Myscope[1].Test[2].Foo#.
Page 866
866 chapter 3: coldfusion functions structinsert description inserts a key-value pair into a structure. Returns true, upon successful completion. If structure does not exist, or if key exists and allowoverwrite = "false" , coldfusion throws an exception. Category structure functions function syntax ...
Page 867
Structinsert 867 structinsert(employee, "lastname", form.Lastname); structinsert(employee, "email", form.Email); structinsert(employee, "phone", form.Phone); structinsert(employee, "department", form.Department); first name is #structfind(employee, "firstname")# last name is #structfind(employee, "l...
Page 868
868 chapter 3: coldfusion functions structisempty description determines whether a structure contains data. Returns true, if structure is empty; if structure does not exist, coldfusion throws an exception. Category decision functions , structure functions function syntax structisempty(structure) see...
Page 869
Structisempty 869 employee add complete.
Page 870
870 chapter 3: coldfusion functions structkeyarray description finds the keys in a coldfusion structure. Returns an array of keys; if structure does not exist, coldfusion throws an exception. Category structure functions function syntax structkeyarray(structure) see also structure functions ; “modif...
Page 871
Structkeyarray 871 value = "" hspace = "30" maxlength = "30"> value = "" hspace = "30" maxlength = "30"> value = "" hspace = "30" maxlength = "30"> value = "" hspace = "20" maxlength = "20"> value = "" hspace = "30" maxlength = "30"> value = "ok"> key#i# is #keystostruct[i]# value#i# is #employee[ke...
Page 872
872 chapter 3: coldfusion functions structkeyexists description determines whether a specific key is present in a structure. Returns true, if key is in structure; if structure does not exist, coldfusion throws an exception. Category decision functions , structure functions function syntax structkeye...
Page 873
Structkeylist 873 structkeylist description extracts keys from a coldfusion structure. Returns a list of keys; if structure does not exist, coldfusion throws an exception. Category structure functions function syntax structkeylist(structure [, delimiter]) see also structure functions ; “modifying a ...
Page 874
874 chapter 3: coldfusion functions this example uses structnew function to create structure "employee" that supplies employee information. The fields are filled with the contents of the following form. After you enter employee information into structure, example uses structkeylist function to list ...
Page 875
Structnew 875 structnew description creates a structure. Returns a structure. Category structure functions function syntax structnew() see also structure functions ; “structure functions” in chapter 5, “using arrays and structures,” in coldfusion mx developer’s guide parameters none example please f...
Page 876
876 chapter 3: coldfusion functions structsort description returns a sorted array of the top level keys in a structure. Sorts using alphabetic or numeric sorting, and can sort based on the values of any structure element. Returns an array of top-level key names (strings), sorted by the value of the ...
Page 877
Structsort 877 employee = structnew() ; employee["salary"] = salary ; // employee.Salary = salary ; employees["employee#i#"] = employee ; departments["department#i#"] = structnew() ; departments["department#i#"].Boss = employee ; } list of employees based on the salary (text search): 1) #arraytolist...
Page 878
878 chapter 3: coldfusion functions structupdate description updates a key with a value. Returns true, on successful execution; if the structure does not exist, coldfusion throws an error. Category structure functions function syntax structupdate(structure, key, value) see also structure functions ;...
Page 879
Tan 879 tan description calculates the tangent of an angle that is entered in radians. Returns a number; the tangent of an angle. Category mathematical functions function syntax tan(number) see also atn , cos , acos , sin , asin , pi parameters usage to convert degrees to radians, multiply degrees b...
Page 880
880 chapter 3: coldfusion functions enter an angle in degrees to get its tangent:.
Page 881
Timeformat 881 timeformat description formats a time value using u.S. English time formatting conventions. Returns a custom-formatted time value. If no mask is specified, returns a time value using the hh:mm tt format. For international time formatting, see lstimeformat . Category date and time func...
Page 882
882 chapter 3: coldfusion functions parameters usage when passing a date/time value as a string, you must enclose it in quotation marks. Otherwise, it is interpreted as a number representation of a date/time object. Database query results for date and time values can vary in sequence and formatting ...
Page 883
Timeformat 883 timeformat function. For example: dateformat(now(), "yyyy-mm-dd")#t#timeformat(now(), "hh:mm:ss") produces: #dateformat(now(), "yyyy-mm-dd")#t#timeformat(now(), "hh:mm:ss")# cfoutput>.
Page 884
884 chapter 3: coldfusion functions tobase64 description calculates the base64 representation of a string or binary object. The base64 format uses printable characters, allowing binary data to be sent in forms and e-mail, and stored in a database or file. Returns the base64 representation of a strin...
Page 885
Tobase64 885 usage macromedia recommends that you use the binaryencode function to convert binary data to base64-encoded data in all new applications. The following string is the concatenation of all characters (32 to 255) from the ascii table. #chardata# tobase64(chardata)> tobase64(binarydata)>.
Page 886
886 chapter 3: coldfusion functions tobinary description calculates the binary representation of base64-encoded data. Returns the binary representation of base64-encoded data. Category conversion functions , string functions function syntax tobinary(string_in_base64 or binary_value) see also • binar...
Page 887
Tobinary 887 tobinary(data64)> representation of string data..
Page 888
888 chapter 3: coldfusion functions toscript description creates a javascript or actionscript expression that assigns the value of a coldfusion variable to a javascript or actionscript variable. This function can convert coldfusion strings, numbers, arrays, structures, and queries to javascript or a...
Page 889
Toscript 889 usage to use a coldfusion variable in javascript or actionscript, the toscript function must be in a cfoutput region and be surrounded by number signs (#). For example, the following code uses the toscript function to convert a coldfusion variable to a javascript variable: var #toscript...
Page 890
890 chapter 3: coldfusion functions an actionscript-style array does not require you to include the wddx.Js file, and creates a variable that you can use in actionscript on a flash format form, for example, in an onchange attribute. If the outputformat parameter is false, setting asformat to true ca...
Page 891
Toscript 891 { document.Write("myarray[" + i + "]: " + jsarray[i] + ""); } this section converts the following query object to both wddx format and actionscript type javascript objects. Select firstname,lastname from employee where firstname = 'john' the query in coldfusion javascript generated by t...
Page 892
892 chapter 3: coldfusion functions tostring description converts a value to a string. Returns a string. Category conversion functions , string functions function syntax tostring(value[, encoding]) see also tobase64 , tobinary , charsetencode ; chapter 35, “using xml and wddx,” in coldfusion mx deve...
Page 893
Tostring 893 parameters usage this function can convert simple values and binary values that do not contain byte zero. If this function cannot convert a value, it throws an exception. This function can also convert an xml document object to a string xml representation. Macromedia recommends that you...
Page 894
894 chapter 3: coldfusion functions tostring(databinary)> the following is the string representation of the binary data. #datastring#.
Page 895
Trim 895 trim description removes leading and trailing spaces from a string. Returns a copy of string, after removing leading and trailing spaces. Category string functions function syntax trim(string) see also ltrim , rtrim parameters example your string:"#form.Mytext#" your string:"#trim(form.Myte...
Page 896
896 chapter 3: coldfusion functions ucase description converts the alphabetic characters in a string to uppercase. Returns a copy of a string, converted to uppercase. Category string functions function syntax ucase(string) see also lcase parameters example your text, #form.Sampletext#, returned in u...
Page 897
Urldecode 897 urldecode description decodes a url-encoded string. Returns a copy of a string, decoded. Category conversion functions , other functions , string functions function syntax urldecode(urlencodedstring[, charset]) see also urlencodedformat ; “tags and functions for globalizing” in chapter...
Page 898
898 chapter 3: coldfusion functions usage url encoding formats some characters with a percent sign and the two-character hexadecimal representation of the character. For example, a character whose code is 129 is encoded as %81 . A space is encoded with a plus sign. Query strings in http are always u...
Page 899
Urlencodedformat 899 urlencodedformat description generates a url-encoded string. For example, it replaces spaces with %20 , and non- alphanumeric characters with equivalent hexadecimal escape sequences. Passes arbitrary strings within a url (coldfusion automatically decodes url parameters that are ...
Page 900
900 chapter 3: coldfusion functions usage url encoding formats some characters with a percent sign and the two-character hexadecimal representation of the character. For example, a character whose code is 129 is encoded as %81 . A space is encoded with a plus sign. Query strings in http are always u...
Page 901
Urlsessionformat 901 urlsessionformat description depending on whether a client computer accepts cookies, this function does the following: • if the client does not accept cookies: automatically appends all required client identification information to a url • if the client accepts cookies: does not...
Page 902
902 chapter 3: coldfusion functions val description converts numeric characters that occur at the beginning of a string to a number. Returns a number. If conversion fails, returns zero. Category conversion functions , string functions function syntax val(string) see also isnumeric parameters usage t...
Page 903
Val 903 value = "is the beginning numeric?" name = "">.
Page 904
904 chapter 3: coldfusion functions valuelist description inserts a delimiter between each value in an executed query. Coldfusion does not evaluate the arguments. Returns a delimited list of the values of each record returned from an executed query. Category list functions , query functions function...
Page 905
Week 905 week description from a date/time object, determines the week number within the year. Returns an integer in the range 1–53; the ordinal of the week, within the year. Category date and time functions function syntax week(date) see also datepart parameters usage when passing date as a string,...
Page 906
906 chapter 3: coldfusion functions wrap description wraps text so that each line has a specified maximum number of characters. Returns string containing the wrapped text. Category string functions function syntax wrap(string, limit[, strip]) see also cfmail history coldfusion mx 6.1: added this fun...
Page 907
Writeoutput 907 writeoutput description appends text to the page-output stream. This function writes to the page-output stream regardless of conditions established by the cfsetting tag. Category other functions , system functions function syntax writeoutput(string ) parameters usage within the cfque...
Page 908
908 chapter 3: coldfusion functions xmlchildpos description gets the position of a child element within an xml document object. Returns the position, in an xmlchildren array, of the nth child that has the specified name. Category xml functions function syntax xmlchildpos(elem, childname, n) see also...
Page 909
Xmlchildpos 909 laura ingalls elempos=xmlchildpos(xmlobject.Employee.Name[1], "status", 2); arraydeleteat(xmlobject.Employee.Name[1].Xmlchildren, elempos);.
Page 910
910 chapter 3: coldfusion functions xmlelemnew description creates an xml document object element. Returns an xml document object element. Category xml functions function syntax xmlelemnew(xmlobj[, namespace], childname) see also cfxml , isxmlelem , xmlchildpos , xmlformat , xmlnew , xmlparse ; chap...
Page 911
Xmlelemnew 911 else mydoc.Myroot.Xmltext = "the value of testvar is false."; for (i = 1; i lte 4; i = i + 1) { mydoc.Myroot.Xmlchildren[i] = xmlelemnew(mydoc,"childnode"); mydoc.Myroot.Xmlchildren[i].Xmltext = "this is child node " & i &"."; }.
Page 912
912 chapter 3: coldfusion functions xmlformat description escapes special xml characters in a string so that the string can be used as text in xml. Returns a copy of the string parameter that is safe to use as text in xml. Category string functions , xml functions function syntax xmlformat(string) s...
Page 913
Xmlformat 913 #"> #xmlformat("body of element with , "" and & goes here.")#.
Page 914
914 chapter 3: coldfusion functions xmlgetnodetype description determines the type of an xml document object node. Returns a string identifying the xml node type. The following values are valid: if the argument is not a document object node, the function generates an error. Category xml functions fu...
Page 915
Xmlgetnodetype 915 imported from france 1 15.95 xmlobject: #xmlgetnodetype(xmlobject)# xmlobject.Order: #xmlgetnodetype(xmlobject.Order)# now check the types of all the nodes in the xmlobject.Order.Items.Item element’s xmlnodes array. Note the many apparently empty text nodes generated by whitespace...
Page 916
916 chapter 3: coldfusion functions xmlnew description creates an xml document object. Returns an empty xml document object. Category xml functions function syntax xmlnew([casesensitive]) see also cfxml , isxmldoc , tostring , xmlformat , xmlparse , xmlvalidate ; chapter 35, “using xml and wddx” in ...
Page 917
Xmlnew 917 example the following example creates and displays a coldfusion document object: mydoc = xmlnew(); mydoc.Xmlroot = xmlelemnew(mydoc,"myroot"); if (testvar is true) mydoc.Myroot.Xmltext = "the value of testvar is true."; else mydoc.Myroot.Xmltext = "the value of testvar is false."; for (i ...
Page 918
918 chapter 3: coldfusion functions xmlparse description converts xml text into an xml document object. Returns an xml document object. Category conversion functions , xml functions function syntax xmlparse(xmltext [[, casesensitive ], validator]) see also cfxml , isxml , tostring , xmlformat , xmln...
Page 919
Xmlparse 919 the casesensitive parameter value determines whether identifiers whose characters are of varying case, but are otherwise the same, refer to different components; for example: • if true, the element or attribute names “name” and “name” refer to different elements or attributes. • if fals...
Page 920
920 chapter 3: coldfusion functions standard paint thinner 3 8.95 the custorder.Dtd file is as follows: id cdata #required> firstname cdata #required lastname cdata #required accountnum cdata #required> id cdata #required> the cfml file is as follows. It uses a filename for the xml file and a url fo...
Page 921
Xmlsearch 921 xmlsearch description uses an xpath language expression to search an xml document object. Returns an array of xml object nodes that match the search criteria. Category xml functions function syntax xmlsearch(xmldoc, xpathstring) see also cfxml , isxml , xmlchildpos , xmlparse , xmltran...
Page 922
922 chapter 3: coldfusion functions laura ingalls the cfml file contains the following lines: myxmldoc = xmlparse("c:\cfusionmx7\wwwroot\examples\employeesimple.Xml"); selectedelements = xmlsearch(myxmldoc, "/employee/name/last"); for (i = 1; i lte arraylen(selectedelements); i = i + 1) writeoutput(...
Page 923
Xmltransform 923 xmltransform description applies an extensible stylesheet language transformation (xslt) to xml. The xml can be in string format or an xml document object. Returns a string containing the results of applying the xslt to the xml. Category conversion functions , xml functions function...
Page 924
924 chapter 3: coldfusion functions if the xslt code contains include statements with relative paths, coldfusion resolves them relative to the location of the xslt file, or for an xsl string, the location of the current coldfusion page. Example the following example converts an xml document that rep...
Page 925
Xmltransform 925 the cfml file has the following lines: variable="xmltrans"> #xmltransform(xmldoc, xmltrans)# variable="xmltrans"> #xmltransform(xmldoc, xmltrans)#.
Page 926
926 chapter 3: coldfusion functions xmlvalidate description uses a document type definition (dtd) or xml schema to validate an xml text document or an xml document object. Returns the following validation structure: category xml functions function syntax xmlvalidate(xmldoc[, validator]) see also cfx...
Page 927
Xmlvalidate 927 usage if you specify a relative url or filename in a parameter, coldfusion uses the directory (or, for urls, the virtual directory) that contains the current coldfusion page as the path root. The validato r parameter specifies a dtd or schema to use to validate the document. If you o...
Page 928
928 chapter 3: coldfusion functions the custorder.Xsd file is as follows: elementformdefault="qualified"> elementformdefault="qualified"> the cfml file is as follows. It uses a filename for the xml file and a url for the schema. The xml and url paths must be absolute. Myresults=xmlvalidate("c:\cfusi...
Page 929
Xmlvalidate 929 did custorder.Xml validate against custorder.Xsd? #results.Status# dump of myresults structure returned by xmlvalidate.
Page 930
930 chapter 3: coldfusion functions year description from a date/time object, gets the year value. Returns the year value of date. Category date and time functions function syntax year(date) see also datepart , isleapyear parameters usage when passing a date as a string, enclose it in quotation mark...
Page 931
Yesnoformat 931 yesnoformat description evaluates a number or boolean value. Returns yes, for a nonzero value; no for zero, false , and no boolean values, and an empty string ( "") . Category decision functions , display and formatting functions function syntax yesnoformat(value) see also isbinary ,...
Page 932
932 chapter 3: coldfusion functions.
Page 933: Chapter 4
933 chapter 4 coldfusion mx flash form style reference this chapter describes the styles that you can specify in macromedia coldfusion mx 7 forms tags when you display the form or form element in flash format. Contents styles valid for all controls . . . . . . . . . . . . . . . . . . . . . . . . . ....
Page 934
934 chapter 4: coldfusion mx flash form style reference styles valid for all controls the following styles are valid for all coldfusion flash format form tags except for cfformitem tags with the following type attributes, which do not take style attributes: • html • space • text these styles do not ...
Page 935
Styles valid for all controls 935 dropshadow n format: boolean; controls the visibility of the component's drop shadow. The default value is false. This style must be used with borderstyle="solid". For drop shadows to appear on containers, set backgroundcolor or backgroundimage. Otherwise, since the...
Page 936
936 chapter 4: coldfusion mx flash form style reference styles for cfform the following styles apply to the cfform tag: styles for cfformgroup with horizontal or vertical type atributes the following styles apply to the cfformgroup tag with type attributes horizontal or vertical : themecolor y forma...
Page 937
Styles for box-style cfformgroup elements 937 styles for box-style cfformgroup elements the following styles apply to the cfformgroup tag with the following type attributes. Some types have additional attributes, which are listed in the following sections. • hbox • vbox • hdividedbox • vdividedbox •...
Page 938
938 chapter 4: coldfusion mx flash form style reference styles specific to cfformgroup with panel type attribute the following additional styles apply to the cfformgroup tag with type="panel" : styles for cfformgroup with accordion type attribute the following styles apply to the cfformgroup tag wit...
Page 939
Styles for cfformitem with hrule or vrule type attributes 939 styles for cfformgroup with tabnavigator type attribute the following styles apply to the cfformgroup tag with the type="tabnavigator" : styles for cfformitem with hrule or vrule type attributes the following styles apply to the formitem ...
Page 940
940 chapter 4: coldfusion mx flash form style reference styles for cfinput with radiobutton, checkbox, button, image, or submit type attributes the following styles apply cfinput tags with the following type attribute values: • button • checkbox • image • radiobutton • submit in some cases, a style ...
Page 941
Styles for cfselect with size attribute value of 1 941 styles for cftextarea tag and cfinput with text, password, or hidden type attributes the following style applies to the following tags and tag-attribute combinations: • textarea • cfinput type="hidden" • cfinput type="password" • cfinput type="t...
Page 942
942 chapter 4: coldfusion mx flash form style reference styles for cfselect with size attribute value greater than 1 the following styles apply to the cfselect tag when the size attribute is greater than 1; that is, if the control is a list box that displays two or more options at a time: styles for...
Page 943
Styles for the cftree tag 943 styles for the cfgrid tag the following styles apply to the cfgrid tag: styles for the cftree tag the following styles apply to the cftree tag: style inh description horizontalalign n horizontal alignment of children in the container. The default value is left. Possible...
Page 944
944 chapter 4: coldfusion mx flash form style reference.
Page 945: Chapter 5
945 chapter 5 application.Cfc reference this chapter describes the methods that you implement in application.Cfc to handle macromedia coldfusion mx 7 application events. It also describes the variables that you set in the cfc to configure application characteristics. Contents application variables ....
Page 946
946 chapter 5: application.Cfc reference the following table briefly describes the variables that you can set to control the application behavior. For more details, see the cfapplication tag. Method summary the following table briefly describes the application event methods that you can implement in...
Page 947
Method summary 947 all parameters to these methods are positional. You can use any names for these parameters. When a request executes, coldfusion mx runs the cfc methods in the following order: 1. Onapplicationstart (if not run before for this application) 2. Onsessionstart (if not run before for t...
Page 948
948 chapter 5: application.Cfc reference onapplicationend description runs when an application times out or the server is shutting down. Syntax ... See also onapplicationstart , method summary , “managing the application with application.Cfc” in chapter 13, “designing and optimizing a coldfusion app...
Page 949
Onapplicationstart 949 onapplicationstart description runs when coldfusion mx receives the first request for a page in the application. Syntax ... Boolean> see also onapplicationend , method summary , “managing the application with application.Cfc” in chapter 13, “designing and optimizing a coldfusi...
Page 950
950 chapter 5: application.Cfc reference this application encountered an error please contact support. Text="cfdocexamples db not available. Message: #cfcatch.Message# detail: #cfcatch.Detail# native error: #cfcatch.Nativeerrorcode#" > application.Availableresources=0; application.Counter1=1; text="...
Page 951
Onerror 951 onerror description runs when an uncaught exception occurs in the application. Syntax ... See also method summary , “handling errors in application.Cfc” in coldfusion mx developer’s guide parameters coldfusion mx passes the following parameters to the method: returns this method does not...
Page 952
952 chapter 5: application.Cfc reference if an exception occurs while processing the onerror method, or if the onerror method uses a cfthrow tag, the coldfusion mx standard error handling mechanisms handle the exception. These mechanisms include: any error handlers specified by cferror tags in the a...
Page 953
Onrequest 953 onrequest description runs when a request starts, after the onrequeststart event handler. If you implement this method, it must explicitly call the requested page to process it. Syntax ... ... See also onrequeststart , onrequestend , method summary , “managing requests in application.C...
Page 954
954 chapter 5: application.Cfc reference • code in this method that precedes the call to the target page can perform the same functions as the onrequeststart method, and shares the variables scope with the target page. • code in this method that follows the call to the target page can perform the sa...
Page 955
Onrequestend 955 onrequestend description runs at the end of a request, after all other cfml code. Syntax ... See also onrequeststart , onrequest , method summary , “managing requests in application.Cfc” in coldfusion mx developer’s guide parameters coldfusion mx passes the following parameters to t...
Page 956
956 chapter 5: application.Cfc reference a very simple authuserfooter.Cfm page consists of the following code: a very simple noauthuserfooter.Cfm page consists of the following code: to test this example, implement code for logging in a user, or try the example with and without the following line in...
Page 957
Onrequeststart 957 onrequeststart description runs when a request starts. Syntax ... Boolean> see also onrequest , onrequestend , method summary , “managing requests in application.Cfc” in coldfusion mx developer’s guide parameters coldfusion mx passes the following parameters to the method: returns...
Page 958
958 chapter 5: application.Cfc reference if ((hour(now()) gt 1) and (hour(now()) lt 3)) { writeoutput("the system is undergoing periodic maintenance. Please return after 3:00 am eastern time."); return false; } else { this.Start=now(); return true; }.
Page 959
Onsessionend 959 onsessionend description runs when a session ends. Syntax ... See also onsessionstart , method summary , “managing sessions in application.Cfc” in coldfusion mx developer’s guide parameters coldfusion mx passes the following parameters to the method: returns this method does not ret...
Page 960
960 chapter 5: application.Cfc reference • you must use the applicationscope parameter to access the application scope. You cannot reference the application scope directly; for example, use arguments.Applicationscope.Myvariable, not application.Myvariable. Use a named lock when you reference variabl...
Page 961
Onsessionstart 961 onsessionstart description runs when a session starts. Syntax ... See also onsessionend , method summary , “managing sessions in application.Cfc” in coldfusion mx developer’s guide returns this method does not return a value; do not use the cfreturn tag. Usage this method is usefu...
Page 962
962 chapter 5: application.Cfc reference.
Page 963: Chapter 6
963 chapter 6 coldfusion mx event gateway reference this chapter describes the java interfaces available for building macromedia coldfusion mx 7 custom cfxs in java. Contents gateway development interfaces and classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 963 cf...
Page 964
964 chapter 6: coldfusion mx event gateway reference gateway interface coldfusion.Eventgateway.Gateway interface for implementing coldfusion mx event gateways. A class that implements this interface defines a coldfusion mx event gateway type that you can use in coldfusion mx applications. The class ...
Page 965
Gateway interface 965 constructor description instantiates a gateway. Category event gateway development syntax public void gatewayname() public void gatewayname(string id) public void gatewayname(string id, string configfile) see also setgatewayid , “class constructor” in chapter 45, “creating cust...
Page 966
966 chapter 6: coldfusion mx event gateway reference getgatewayid description returns the gateway id that identifies the gateway instance. Category event gateway development syntax public string getgatewayid() see also setgatewayid , “providing gateway class service and information routines” in chap...
Page 967
Gateway interface 967 gethelper description returns an instance of the gatewayhelper class, if any for the gateway type. Category event gateway development syntax public gatewayhelper gethelper() see also gatewayhelper interface ; “providing gateway class service and information routines” in chapter...
Page 968
968 chapter 6: coldfusion mx event gateway reference getstatus description returns the gateway status. Category event gateway development syntax public int getstatus() see also “providing gateway class service and information routines” in chapter 45, “creating custom event gateways” in coldfusion mx...
Page 969
Gateway interface 969 outgoingmessage description sends a message from coldfusion to a message receiver. Category event gateway development syntax public string outgoingmessage(coldfusion.Eventgateway.Cfevent message) see also “responding to a coldfusion function or listener cfc” in chapter 45, “cre...
Page 970
970 chapter 6: coldfusion mx event gateway reference retcode="failed"; } } else if (data.Get("originatorid") != null && message != null) { socketserverthread st = ((socketserverthread)socketregistry.Get(data.Get("originatorid"))); if(st != null) st.Writeoutput(message); else { log.Error("cannot send...
Page 971
Gateway interface 971 restart description stops a gateway if it is running and starts it up. Category event gateway development syntax public void restart() see also start , stop usage in most cases, you implement this method as a call to the stop method followed by a start method, but you may be ab...
Page 972
972 chapter 6: coldfusion mx event gateway reference setcfclisteners description sets the array of listener cfcs that the gateway sends messages to. Category event gateway development syntax public void setcfclisteners(string[] listeners) see also constructor , getgatewayid , setcfcpath , “providing...
Page 973
Gateway interface 973 setgatewayid description sets the gateway id that uniquely identifies the gateway instance. Category event gateway development syntax public void setgatewayid(string id) see also constructor , getgatewayid , “providing gateway class service and information routines” in chapter ...
Page 974
974 chapter 6: coldfusion mx event gateway reference start description starts a gateway running. Category event gateway development syntax public void start() see also restart , stop , “the start method” in chapter 45, “creating custom event gateways” in coldfusion mx developer’s guide usage start a...
Page 975
Gateway interface 975 stop description stops a gateway if it is running. Category event gateway development syntax public void stop() see also restart , start , “the stop method” in chapter 45, “creating custom event gateways” in coldfusion mx developer’s guide usage stops a gateway by performing an...
Page 976
976 chapter 6: coldfusion mx event gateway reference gatewayhelper interface coldfusion.Eventgateway.Gatewayhelper coldfusion mx includes a coldfusion.Eventgateway.Gatewayhelper java marker interface, with no methods. Implement this interface to define a class that provides gateway-specific utility ...
Page 977
Gatewayservices class 977 gatewayservices class coldfusion.Eventgateway.Gatewayservices the gateway class uses the coldfusion.Eventgateway.Gatewayservices class to interact with the coldfusion event gateway services. This class has the following methods: signature description gatewayservices getgate...
Page 978
978 chapter 6: coldfusion mx event gateway reference getgatewayservices description static method that returns the gatewayservices object. Gateway code can call this method at any time, if required. Category event gateway development syntax gatewayservices getgatewayservices() see also “gatewayservi...
Page 979
Gatewayservices class 979 addevent description sends a cfevent instance to coldfusion for dispatching to a listener cfc. Category event gateway development syntax boolean addevent(cfevent msg) see also getmaxqueuesize , getmaxqueuesize , “responding to incoming messages” in chapter 45, “creating cus...
Page 980
980 chapter 6: coldfusion mx event gateway reference getlogger description returns a coldfusion logger object that the event gateway can use to log information in a file. Category event gateway development syntax coldfusion.Eventgateway.Logger getlogger([string logfile]) see also logger class , “log...
Page 981
Gatewayservices class 981 getmaxqueuesize description returns the maximum size of the coldfusion event queue, as set in the coldfusion mx administrator. Category event gateway development syntax int getmaxqueuesize() see also addevent , getqueuesize returns the integer maximum number of messages tha...
Page 982
982 chapter 6: coldfusion mx event gateway reference getqueuesize description returns the current size of the coldfusion event queue that handles all messages for all gateways. Category event gateway development syntax int getqueuesize() see also addevent , getmaxqueuesize returns the integer number...
Page 983
Cfevent class 983 cfevent class coldfusion.Gateway.Cfevent the gateway class sends and receives cfevent instances to communicate with the coldfusion listener cfc or application. The cfevent instances correspond to cfml cfevent structure s that coldfusion application listener cfc methods receive and ...
Page 984
984 chapter 6: coldfusion mx event gateway reference cfevent description cfevent constructor. Category event gateway development syntax cfevent(string gatewayid) see also getgatewayid , “cfml cfevent structure” on page 1004 , “cfevent class” in chapter 45, “creating custom event gateways” in coldfus...
Page 985
Cfevent class 985 getcfcmethod description gets the name of the cfc method that processes the message. Category event gateway development syntax string getcfcmethod() see also getcfcpath , getcfctimeout , setcfcmethod , “cfml cfevent structure” on page 1004 , “cfevent class” in chapter 45, “creating...
Page 986
986 chapter 6: coldfusion mx event gateway reference getcfcpath description gets the path to the listener cfc that processes this message. Category event gateway development syntax string getcfcpath() see also getcfcmethod , getcfctimeout , setcfcpath , “cfml cfevent structure” on page 1004 , “cfeve...
Page 987
Cfevent class 987 getcfctimeout description gets the time-out, in seconds, for the listener cfc to process the event request. Category event gateway development syntax string getcfctimeout() see also getcfcmethod , getcfcpath , setcfctimeout , “cfml cfevent structure” on page 1004 , “cfevent class” ...
Page 988
988 chapter 6: coldfusion mx event gateway reference getdata description returns the data map that contains the message contents and other gateway-specific information. Category event gateway development syntax map getdata() see also setdata , “cfml cfevent structure” on page 1004 , “cfevent class” ...
Page 989
Cfevent class 989 getgatewayid description returns the gateway id field of the cfevent object. Category event gateway development syntax string getgatewayid(cfevent event) see also cfevent , “cfml cfevent structure” on page 1004 , “cfevent class” in chapter 45, “creating custom event gateways” in co...
Page 990
990 chapter 6: coldfusion mx event gateway reference getgatewaytype description returns the gateway type field of the cfevent object. Category event gateway development syntax string getgatewaytype() see also setgatewaytype , “cfml cfevent structure” on page 1004 , “cfevent class” in chapter 45, “cr...
Page 991
Cfevent class 991 getoriginatorid description identifies the originator of an incoming message. Some gateway types also use this field for the destination of an outgoing message. Category event gateway development syntax string getoriginatorid() see also setoriginatorid , “cfml cfevent structure” on...
Page 992
992 chapter 6: coldfusion mx event gateway reference setcfcmethod description sets the name of the cfc method that will processes an incoming message. Category event gateway development syntax void setcfcmethod(string method) see also getcfcmethod , setcfcpath , setcfctimeout , “cfml cfevent structu...
Page 993
Cfevent class 993 setcfcpath description specifies the listener cfc that will process this event. Category event gateway development syntax void setcfcpath(string path) see also getcfcpath , setcfcmethod , setcfctimeout , “cfevent class” in chapter 45, “creating custom event gateways” in coldfusion ...
Page 994
994 chapter 6: coldfusion mx event gateway reference setcfctimeout description sets the time-out, in seconds, during which the listener cfc must process the event request and return before coldfusion gateway services terminates the request. Category event gateway development syntax void setcftimeout...
Page 995
Cfevent class 995 setdata description adds the gateway-specific data, including any message contents, as a java map to the cfevent object category event gateway development syntax void setdata(map data) see also getdata , “cfml cfevent structure” on page 1004 , “cfevent class” in chapter 45, “creati...
Page 996
996 chapter 6: coldfusion mx event gateway reference setgatewaytype description identifies the type of event gateway. Category event gateway development syntax void setgatewaytype(string gatewaytype) see also parameters getgatewaytype , “cfml cfevent structure” on page 1004 , “cfevent class” in chap...
Page 997
Cfevent class 997 setoriginatorid description identifies the originator of an incoming message. Category event gateway development syntax void setoriginatorid(string originatorid) see also getoriginatorid , “cfml cfevent structure” on page 1004 , “cfevent class” in chapter 45, “creating custom event...
Page 998
998 chapter 6: coldfusion mx event gateway reference logger class coldfusion.Eventgateway.Logger note: this class is in the coldfusion.Log package, not the coldfusion.Eventgateway package, which contains all other event gateway-related interfaces and classes. The logger class logs messages to a file...
Page 999
Logger class 999 debug description writes a log entry with a debugging severity to the coldfusion mx logger. The entry includes the severity, thread id, date, time, and a text message. Category event gateway development syntax debug(string message) debug(throwable th) debug(string message, throwable...
Page 1000
1000 chapter 6: coldfusion mx event gateway reference error description writes a log entry with an error severity to the coldfusion mx logger. The entry includes the severity, thread id, date, time, and a text message. Category event gateway development syntax error(string message) error(throwable t...
Page 1001
Logger class 1001 fatal description writes a log entry with a fatal severity to the coldfusion mx logger. The entry includes the severity, thread id, date, time, and a text message. Category event gateway development syntax fatal(string message) fatal(throwable th) fatal(string message, throwable th...
Page 1002
1002 chapter 6: coldfusion mx event gateway reference info description writes a log entry with an information severity to the coldfusion mx logger. The entry includes the severity, thread id, date, time, and a text message. Category event gateway development syntax info(string message) info(throwabl...
Page 1003
Logger class 1003 warn description writes a log entry with a warning severity to the coldfusion mx logger. The entry includes the severity, thread id, date, time, and a text message. Category event gateway development syntax warn(string message) warn(throwable th) warn(string message, throwable th) ...
Page 1004
1004 chapter 6: coldfusion mx event gateway reference cfml cfevent structure the cfml listener cfc methods receive messages in the form of a cfevent structure that corresponds to the cfevent class that gateway developers use. This structure has the following fields. Some of the fields might not be u...
Page 1005
Im gateway cfc incoming message methods 1005 im gateway cfc incoming message methods you write the following cfc methods to handle incoming messages from an xmpp or lotus sametime instant messaging gateway. Note: the method names assume a default gateway configuration. Coldfusion lets you change the...
Page 1006
1006 chapter 6: coldfusion mx event gateway reference onaddbuddyrequest description handles incoming requests for users to add the gateway user name as one of their buddies. Syntax onaddbuddyrequest(cfevent) see also onincomingmessage , onaddbuddyresponse , onbuddystatus , onimservermessage paramete...
Page 1007
Im gateway cfc incoming message methods 1007 example the following example searches for the requested buddy’s name in a data source and, if it finds a unique entry, adds the buddy and updates the buddy’s status information in an application scope buddystatus structure. If it doesn’t find the name, i...
Page 1008
1008 chapter 6: coldfusion mx event gateway reference.
Page 1009
Im gateway cfc incoming message methods 1009 onaddbuddyresponse description handles incoming responses from other users to requests from the gateway to be added to their buddy lists. Also receives requests from buddies to have you remove them from your buddy list. Syntax onaddbuddyresponse(cfevent) ...
Page 1010
1010 chapter 6: coldfusion mx event gateway reference application.Buddystatus[#cfevent.Data.Sender#]=structnew(); } //set the buddy status information to indicate buddy was added. Application.Buddystatus[#cfevent.Data.Sender#].Status= "buddy accepted us"; application.Buddystatus[#cfevent.Data.Sender...
Page 1011
Im gateway cfc incoming message methods 1011 onbuddystatus description handles incoming messages indicating online status (presence) changes of users on the gateway’s buddy list. Syntax onbuddystatus(cfevent) see also onincomingmessage , onaddbuddyrequest , onaddbuddyresponse , onimservermessage par...
Page 1012
1012 chapter 6: coldfusion mx event gateway reference example the following example keeps an application scope structure up-to-date with a buddy’s status. It also uses the gatewayhelper object getbuddystatus method to get the buddy’s custom away message, if any. Text="in onbuddystatus, sender is #cf...
Page 1013
Im gateway cfc incoming message methods 1013 onimservermessage description handles incoming error and status messages from the im server. Syntax onimservermessage(cfevent) see also onincomingmessage , onaddbuddyrequest , onaddbuddyresponse , onbuddystatus parameters this method must take one paramet...
Page 1014
1014 chapter 6: coldfusion mx event gateway reference onincomingmessage description handles incoming instant messages from other users. Optionally returns a response to the message sender. Syntax onincomingmessage(cfevent) see also onaddbuddyrequest , onaddbuddyresponse , onbuddystatus , onimserverm...
Page 1015
Im gateway cfc incoming message methods 1015.
Page 1016
1016 chapter 6: coldfusion mx event gateway reference im gateway message sending commands you use the sendgatewaymessage cfml function or the return value of a cfc listener method to send outgoing messages. The coldfusion mx 7 im gateway accepts the following outgoing message commands: the message s...
Page 1017
Im gateway gatewayhelper class methods 1017 im gateway gatewayhelper class methods the gatewayhelper class returned by the cfml getgatewayhelper function includes the following methods: addbuddy getdenylist getstatusasstring removedeny adddeny getname getstatustimestamp removepermit addpermit getnic...
Page 1018
1018 chapter 6: coldfusion mx event gateway reference addbuddy description adds a buddy to the buddy list for the gateway user id and asks to have the im server send messages with the buddy’s online presence state to the gateway. Syntax boolean = addbuddy(name, nickname, group) see also getbuddyinfo...
Page 1019
Im gateway gatewayhelper class methods 1019 adddeny description tells the im server to add the specified user to the deny list for the gateway’s user id. If the gateway’s permit mode value is deny_some, the specified user cannot receive messages on the gateway’s presence state. Syntax boolean = addd...
Page 1020
1020 chapter 6: coldfusion mx event gateway reference addpermit description tells the im server to add the specified user to the permit list for the gateway’s user id. If the gateway’s permit mode is permit_some, the specified user receive messages on the gateway’s presence state. Syntax boolean = a...
Page 1021
Im gateway gatewayhelper class methods 1021 getbuddyinfo description gets information about the specified user from the buddy list, deny list, and permit list. Syntax array = getbuddyinfo(name) see also addbuddy , getbuddylist , removebuddy , “using the gatewayhelper object” in chapter 43, “using th...
Page 1022
1022 chapter 6: coldfusion mx event gateway reference example see “gatewayhelper example”, in chapter 43, “using the instant messaging event gateways” in coldfusion mx developer’s guide, which uses all gatewayhelper class methods. For an example of using this method to get the buddy custom away mess...
Page 1023
Im gateway gatewayhelper class methods 1023 getbuddylist description gets the buddy list for the gateway’s user id. Syntax array = getbuddylist() see also addbuddy , getbuddyinfo , removebuddy , “using the gatewayhelper object” in chapter 43, “using the instant messaging event gateways” in coldfusio...
Page 1024
1024 chapter 6: coldfusion mx event gateway reference getcustomawaymessage description returns the gateway’s custom away message if it has been set by the gatewayhelper object setstatus method. Syntax string = getcustomawaymessage() see also getstatusasstring , getstatustimestamp , isonline , setsta...
Page 1025
Im gateway gatewayhelper class methods 1025 getdenylist description returns the list of users that the im server has been told not to send state information about the gateway, if the permit mode is set to deny_some. Syntax array = getdenylist() see also adddeny , addpermit , getpermitlist , getpermi...
Page 1026
1026 chapter 6: coldfusion mx event gateway reference getname description returns the gateway's user name. Syntax string = getname() see also getprotocolname , numberofmessagesreceived , numberofmessagessent , setnickname , “using the gatewayhelper object” in chapter 43, “using the instant messaging...
Page 1027
Im gateway gatewayhelper class methods 1027 getnickname description returns the gateway’s nickname (display name), if it has been set using the gatewayhelper object setnickname method. Syntax string = getnickname() see also getname , getprotocolname , numberofmessagesreceived , numberofmessagessent ...
Page 1028
1028 chapter 6: coldfusion mx event gateway reference getpermitlist description returns the list of users that the im server has been told to send state information about the gateway. Syntax array = getpermitlist() see also adddeny , addpermit , getdenylist , getpermitmode , removedeny , removepermi...
Page 1029
Im gateway gatewayhelper class methods 1029 getpermitmode description gets the gateway’s permit mode from the im server. The permit mode determines whether all users can get the gateway’s online state information, or whether the server uses a permit list or a deny list to control which users get sta...
Page 1030
1030 chapter 6: coldfusion mx event gateway reference getprotocolname description gets the name of the gateway’s instant messaging protocol. Syntax string = getprotocolname() see also getname , getnickname , numberofmessagesreceived , numberofmessagessent , setnickname , “using the gatewayhelper obj...
Page 1031
Im gateway gatewayhelper class methods 1031 getstatusasstring description gets the online status of the gateway as a text string. Syntax string = getstatusasstring() see also getcustomawaymessage , getstatustimestamp , isonline , setstatus , “using the gatewayhelper object” in chapter 43, “using the...
Page 1032
1032 chapter 6: coldfusion mx event gateway reference getstatustimestamp description gets the date and time that the gateway changed its online status. Syntax date-time object = getstatustimestamp() see also getcustomawaymessage , getstatusasstring , isonline , setstatus , “using the gatewayhelper o...
Page 1033
Im gateway gatewayhelper class methods 1033 isonline description determines whether the gateway is connected to the instant messaging server. Syntax boolean = isonline() see also getcustomawaymessage , getstatusasstring , getstatustimestamp , setstatus , “using the gatewayhelper object” in chapter 4...
Page 1034
1034 chapter 6: coldfusion mx event gateway reference numberofmessagesreceived description gets the number of messages received by the gateway since it was started. Syntax integer = numberofmessagesreceived() see also getname , getnickname , getprotocolname , numberofmessagessent , setnickname , “us...
Page 1035
Im gateway gatewayhelper class methods 1035 numberofmessagessent description gets the number of messages sent by the gateway since it was started. Syntax integer = numberofmessagessent() see also getname , getnickname , getprotocolname , numberofmessagesreceived , setnickname , “using the gatewayhel...
Page 1036
1036 chapter 6: coldfusion mx event gateway reference removebuddy description removes an id from a group in the buddy list for the gateway and tells the im server not to send the gateway messages with the buddy’s online presence state. Syntax boolean = removebuddy(name, group) see also addbuddy , ge...
Page 1037
Im gateway gatewayhelper class methods 1037 removedeny description removes an id from a group in the deny list for the gateway. If the gateway’s permit mode is deny_some, the specified user can receive messages on the gateway’s presence state. Syntax boolean = removedeny(name, group) see also addden...
Page 1038
1038 chapter 6: coldfusion mx event gateway reference removepermit description removes an id from a group in the permit list for the gateway. If the gateway’s permit mode is permit_some, the specified user cannot receive messages on the gateway's presence state. Syntax boolean = removepermit(name, g...
Page 1039
Im gateway gatewayhelper class methods 1039 setnickname description sets the gateway’s nickname (display name). Syntax boolean = setnickname(name) see also getname , getnickname , getprotocolname , numberofmessagesreceived , numberofmessagessent , “using the gatewayhelper object” in chapter 43, “usi...
Page 1040
1040 chapter 6: coldfusion mx event gateway reference setpermitmode description sets the gateway’s permit mode on the im server. The permit mode determines whether all users can get the gateway's online state information, or whether the server uses a permit list or a deny list to control which users...
Page 1041
Im gateway gatewayhelper class methods 1041 setstatus description sets the online presence status of the gateway, including any custom away message. Syntax boolean = setstatus(status, customawaymsg) see also getcustomawaymessage , getstatusasstring , getstatustimestamp , isonline , “using the gatewa...
Page 1042
1042 chapter 6: coldfusion mx event gateway reference sms gateway cfevent structure and commands this section describes the detailed contents of the following structures that you use in the sms gateway listener cfcs and cfml sendgatewaymessage functions: • sms gateway incoming message cfevent struct...
Page 1043
Sms gateway incoming message cfevent structure 1043 sms gateway incoming message cfevent structure the sms gateway puts the following information in a cfevent instance that it sends to the cfc listener method: field value originatorid contents of the pdu source_addr field, the address of the device ...
Page 1044
1044 chapter 6: coldfusion mx event gateway reference for more information on the meanings of some of these fields and how to handle incoming sms messages an sms gateway listener cfc method, see “handling incoming messages” in chapter 44, “using the sms event gateway” in coldfusion mx developer’s gu...
Page 1045
Sms gateway message sending commands 1045 sms gateway message sending commands coldfusion applications that use gateways of the short message service (sms) type can send the following commands to the event gateway in an outgoing message: • submit command • submitmulti command • data command.
Page 1046
1046 chapter 6: coldfusion mx event gateway reference submit command to send a message to a single destination address in an smpp submit_sm pdu, the structure that you used in the data parameter of a sendgatewaymessage function or the return variable of the cfc listener method has the following fiel...
Page 1047
Sms gateway message sending commands 1047 example the following example onincomingmessage method of a listener cfc uses the submit command to echo incoming sms messages to the message originator:.
Page 1048
1048 chapter 6: coldfusion mx event gateway reference submitmulti command to send a single text message to multiple recipients using an smpp submit_multi pdu, the data parameter of a sendgatewaymessage function or the return variable of the cfc listener method usually has the following fields. For m...
Page 1049
Sms gateway message sending commands 1049 example the following example onincomingmessage method sends a response that echoes an incoming message to the originator address, and sends a copy of the response to a second address:.
Page 1050
1050 chapter 6: coldfusion mx event gateway reference data command to send binary data to a single destination address in an smpp data_sm pdu, the data parameter of a sendgatewaymessage function or the return variable of the cfc listener method must have the following fields. For more information ab...
Page 1051
Sms gateway message sending commands 1051 example the following example onincomingmessage method converts an incoming message to binary data, and sends the binary version of the message back to the originator address:.
Page 1052
1052 chapter 6: coldfusion mx event gateway reference cfml event gateway sendgatewaymessage data parameter the coldfusion cfml gateway type enables you to invoke cfc methods asynchronously. The structure that you use in the sendgatewaymessage function data parameter can include two types of fields: ...
Page 1053
Cfml event gateway sendgatewaymessage data parameter 1053 the cfc method uses the originatorid and the message, file, and type fields of the cfevent parameter’s data field to specify the log file and message. If (not isdefined("cfevent.Data.File")) { cfevent.Data.File="defaulteventlog"; } if (not is...
Page 1054
1054 chapter 6: coldfusion mx event gateway reference.
Page 1055: Chapter 7
1055 chapter 7 coldfusion c++ cfx reference this chapter describes the macromedia coldfusion mx 7 cfxapi classes and methods. Contents c++ class overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1055 deprecated class methods. . ....
Page 1056
1056 chapter 7: coldfusion c++ cfx reference deprecated class methods the following cfxapi classes and methods are deprecated. They do not work, and might cause an error, in later releases. Ccfxexception class an abstract class that represents an exception thrown during processing of a coldfusion ex...
Page 1057
Ccfxexception class 1057 ccfxexception::geterror description provides basic user output for exceptions that occur during processing. Ccfxexception::getdiagnostics description provides detailed user output for exception that occur during processing. Example this code block shows how geterror and getd...
Page 1058
1058 chapter 7: coldfusion c++ cfx reference ccfxquery class an abstract class that represents a query used or created by a coldfusion extension (cfx). Queries contain one or more columns of data that extend over a varying number of rows. Class methods ccfxquery::addrow syntax int ccfxquery::addrow(...
Page 1059
Ccfxquery class 1059 example the following example shows the addition of two rows to a three-column ('city', 'state', and 'zip') query: // first row int irow ; irow = pquery->addrow() ; pquery->setdata( irow, icity, "minneapolis" ) ; pquery->setdata( irow, istate, "mn" ) ; pquery->setdata( irow, izi...
Page 1060
1060 chapter 7: coldfusion c++ cfx reference ccfxquery::getdata syntax lpcstr ccfxquery::getdata(int irow, int icolumn) description gets a data element from a row and column of a query. Row and column indexes begin with 1. You can determine the number of rows in a query by calling ccfxquery::getrowc...
Page 1061
Ccfxquery class 1061 example the following example retrieves the name of a query and writes it back to the user: ccfxquery* pquery = prequest->getquery() ; prequest->write( "the query name is: " ) ; prequest->write( pquery->getname() ) ; ccfxquery::getrowcount syntax int ccfxquery::getrowcount(void)...
Page 1062
1062 chapter 7: coldfusion c++ cfx reference example the following example shows the addition of two rows to a three-column ('city', 'state', and 'zip') query: // first row int irow ; irow = pquery->addrow() ; pquery->setdata( icity, irow, "minneapolis" ) ; pquery->setdata( istate, irow, "mn" ) ; pq...
Page 1063
Ccfxrequest class 1063 ccfxrequest::addquery syntax ccfxquery* ccfxrequest::addquery(lpcstr lpszname, ccfxstringset* pcolumns) description adds a query to the calling template. The query can be accessed by cfml tags (for example, cfoutput or cftable ) within the template. After calling addquery , th...
Page 1064
1064 chapter 7: coldfusion c++ cfx reference example the following example adds a query named 'people' to the calling template. The query has two columns ('firstname' and 'lastname') and two rows: // create a string set and add the column names to it ccfxstringset* pcolumns = prequest->createstrings...
Page 1065
Ccfxrequest class 1065 ccfxrequest::createstringset syntax ccfxstringset* ccfxrequest::createstringset(void) description allocates and returns an instance. Always use this function to create string sets, as opposed to directly using the new operator. Returns returns an object of ccfxstringset class ...
Page 1066
1066 chapter 7: coldfusion c++ cfx reference returns returns the value of the attribute passed to the tag. If no attribute of that name was passed to the tag, an empty string is returned. Parameters example the following example retrieves an attribute named destination and writes its value back to t...
Page 1067
Ccfxrequest class 1067 ccfxrequest::getcustomdata syntax lpvoid ccfxrequest::getcustomdata(void) description gets the custom (tag specific) data for the request. This method is typically used from within subroutines of a tag implementation to extract tag data from a request. Returns returns a pointe...
Page 1068
1068 chapter 7: coldfusion c++ cfx reference example the following example retrieves the query that was passed to the tag. If no query was passed, an exception is thrown: ccfxquery* pquery = prequest->getquery() ; if ( pquery == null ) { prequest->throwexception( "missing query parameter", "you must...
Page 1069
Ccfxrequest class 1069 ccfxrequest::setcustomdata syntax void ccfxrequest::setcustomdata(lpvoid lpvdata) description sets custom (tag specific) data to carry with the request. Use this function to store request specific data to pass to procedures within your custom tag implementation. Parameters exa...
Page 1070
1070 chapter 7: coldfusion c++ cfx reference example the following example sets the value of a variable named 'messagesent' based on the success of an operation performed by the custom tag: bool bmessagesent; ...Attempt to send the message... If ( bmessagesent == true ) { prequest->setvariable( "mes...
Page 1071
Ccfxrequest class 1071 ccfxrequest::write syntax void ccfxrequest::write(lpcstr lpszoutput) description writes text output back to the user. Parameters example the following example creates a buffer to hold an output string, fills the buffer with data, and writes the output back to the user: char bu...
Page 1072
1072 chapter 7: coldfusion c++ cfx reference ccfxstringset class abstract class that represents a set of ordered strings. Strings can be added to a set and can be retrieved by a numeric index (index values for strings are 1-based). To create a string set, use ccfxrequest::createstringset . Class met...
Page 1073
Ccfxstringset class 1073 description gets the number of strings in a string set. The value can be used with ccfxstringset::getstring to iterate over the strings in the set (recall that the index values for strings in the list begin at 1). Returns returns the number of strings contained in the string...
Page 1074
1074 chapter 7: coldfusion c++ cfx reference ccfxstringset::getstring syntax lpcstr ccfxstringset::getstring(int iindex) description retrieves the string located at the passed index (index values are 1-based). Returns returns the string located at the passed index. Parameters example the following e...
Page 1075: Chapter 8
1075 chapter 8 coldfusion java cfx reference this chapter describes the java interfaces available for building macromedia coldfusion mx 7 custom cfxs in java. Contents class libraries overview. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10...
Page 1076
1076 chapter 8: coldfusion java cfx reference custom tag interface public abstract interface customtag interface for implementing custom tags. Classes that implement this interface can be specified in the class attribute of the java cfx tag. For example, in a class mycustomtag, which implements this...
Page 1077
Query interface 1077 parameters query interface public abstract interface query interface to a query used or created by a custom tag. A query contains tabular data organized by named columns and rows. Methods addrow description adds a row to a query. Call this method to append a row to a query. Retu...
Page 1078
1078 chapter 8: coldfusion java cfx reference int icity = 1, istate = 2, izip = 3 ; // first row int irow = query.Addrow() ; query.Setdata( irow, icity, "minneapolis" ) ; query.Setdata( irow, istate, "mn" ) ; query.Setdata( irow, izip, "55345" ) ; // second row irow = query.Addrow() ; query.Setdata(...
Page 1079
Query interface 1079 getcolumns description returns an array of strings containing the names of the columns in the query. Category query interface syntax public string[] getcolumns() example the following example retrieves the array of columns, then iterates over the list, writing each column name b...
Page 1080
1080 chapter 8: coldfusion java cfx reference parameters example the following example iterates over the rows of a query and writes the data back to the user in a simple, space-delimited format: int irow, icol ; int nnumcols = query.Getcolumns().Length ; int nnumrows = query.Getrowcount() ; for ( ir...
Page 1081
Query interface 1081 example the following example retrieves the number of rows in a query and writes it back to the user: query query = request.Getquery() ; int rows = query.Getrowcount() ; response.Write( "the number of rows in the query is " + integer.Tostring(rows) ) ; setdata description sets a...
Page 1082
1082 chapter 8: coldfusion java cfx reference query.Setdata( irow, icity, "st. Paul" ) ; query.Setdata( irow, istate, "mn" ) ; query.Setdata( irow, izip, "55105" ) ; request interface public abstract interface request interface to a request made to a customtag. The interface includes methods for ret...
Page 1083
Request interface 1083 example the following example checks whether the user passed an attribute named destination to the tag; if not, it throws an exception: if ( ! Request.Attributeexists("destination") ) { throw new exception( "missing destination parameter", "you must pass a destination paramete...
Page 1084
1084 chapter 8: coldfusion java cfx reference syntax public string getattribute(string name) see also attributeexists , getattributelist , getintattribute , getattribute parameters example the following example retrieves an attribute named destination and writes its value back to the user: string st...
Page 1085
Request interface 1085 getintattribute description retrieves the value of the passed attribute as an integer. Returns -1 if the attribute does not exist. Use attributeexists to test whether an attribute was passed to the tag. Use getintattribute(string,int) to return a default value rather than thro...
Page 1086
1086 chapter 8: coldfusion java cfx reference syntax public query getquery() example the following example retrieves a query that was passed to a tag. If no query was passed, an exception is thrown: query query = request.Getquery() ; if ( query == null ) { throw new exception( "missing query paramet...
Page 1087
Response interface 1087 response interface public abstract interface response interface to response generated from a custom tag. This interface includes methods for writing output, generating queries, and setting variables in the calling page. Methods addquery description adds a query to the calling...
Page 1088
1088 chapter 8: coldfusion java cfx reference int ifirstname = 1, ilastname = 2 ; // create a query which contains these columns query query = response.Addquery( "people", columns ) ; // add data to the query int irow = query.Addrow() ; query.Setdata( irow, ifirstname, "john" ) ; query.Setdata( irow...
Page 1089
Response interface 1089 write description outputs text back to the user. Category response interface syntax public void write(string output) parameters example the following example outputs the value of the destination attribute: response.Write( "destination = " + request.Getattribute("destination")...
Page 1090
1090 chapter 8: coldfusion java cfx reference debugging classes reference the constructors and methods supported by the debugrequest , debugresponse , and debugquery classes are as follows. These classes also support the other methods of the request , response , and query interfaces, respectively. D...
Page 1091: Chapter 9
1091 chapter 9 wddx javascript objects this chapter provides information about javascript objects and functions used to wddx in a macromedia coldfusion mx 7 application. Contents javascript object overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ...
Page 1092
1092 chapter 9: wddx javascript objects wddxserializer object the wddxserializer object includes functions that serialize any javascript data structure. For more information on using this object, see “using wddx” in chapter 35, “using xml and wddx” in coldfusion mx developer’s guide. Functions the o...
Page 1093
Wddxserializer object 1093 if (wddxpacket != null) { formfield.Value = wddxpacket; } else { alert("couldn't serialize data"); } } serializevariable description serializes a property of a structure. If an object is not a string, number, array, boolean, or date, wddxserializer treats it as a structure...
Page 1094
1094 chapter 9: wddx javascript objects serializevalue description recursively serializes eligible data in a passed instance. Eligible data includes: • string • number • boolean • date • array • recordset • any javascript object this function serializes null values as empty strings. Syntax object.Se...
Page 1095
Wddxrecordset object 1095 write description appends data to a serialized data stream. Syntax object.Write( str ) parameters return value returns an updated serialized data stream as a string. Usage this is an internal function; you do not typically call it. Example this example is from the wddxseria...
Page 1096
1096 chapter 9: wddx javascript objects returns html table of the wddxrecordset object data. Usage convenient for debugging and testing record sets. The boolean parameter escapestrings determines whether & characters in string values are escaped as & in html. Example select message_id, thread_id, us...
Page 1097
Wddxrecordset object 1097 usage adds a column to every row of the wddx record set. Initially the new column’s values are set to null. Example this example calls the addcolumn function: // create a new record set rs = new wddxrecordset(); // add a new column rs.Addcolumn("newcolumn"); // extend the r...
Page 1098
1098 chapter 9: wddx javascript objects // extend the record set by 3 rows rs.Addrows(3); // set an element in the first row // newvalue is a previously defined variable rs.Setfield(0, "newcolumn", newvalue); getfield description returns the element in the specified row/column position. Syntax objec...
Page 1099
Wddxrecordset object 1099 parameters return value integer. Returns the number of rows in the wddxrecordset instance. Usage call this function before a looping construct to determine the number of rows in a record set. Example this example calls the getrowcount function: function dumpwddxrecordset(r)...
Page 1100
1100 chapter 9: wddx javascript objects // add a new column rs.Addcolumn("newcolumn"); // extend the record set by 3 rows rs.Addrows(3); // set an element in the first row // newvalue is a previously defined variable rs.Setfield(0, "newcolumn", newvalue); wddxserialize description serializes a recor...
Page 1101: Chapter 10
1101 chapter 10 coldfusion actionscript functions this chapter explains the syntax and usage of the two macromedia coldfusion mx 7 server-side actionscript functions, cf.Query and cf.Http . Contents cf.Query . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ...
Page 1102
1102 chapter 10: coldfusion actionscript functions cf.Query description performs queries against coldfusion data sources. Return value returns a recordset object. Syntax cf.Query ({ datasource:"data source name", sql:"sql stmts", username:"username", password:"password", maxrows:number, timeout:mill...
Page 1103
Cf.Query 1103 you can manipulate the record set returned by the cf.Query function using methods in the recordset actionscript class. The following are some of the methods available in the recordset class: • recordset.Getcolumnnames • recordset.Getlength • recordset.Getitemat • recordset.Getitemid • ...
Page 1104
1104 chapter 10: coldfusion actionscript functions cf.Http description executes http post and get operations on files. (post operations upload mime file types to a server, or post cookie, formfield, url, file, or cgi variables directly to a server.) return value returns an object containing properti...
Page 1105
Cf.Http 1105 usage you can write the cf.Http function using named arguments or positional arguments. You can invoke all supported arguments using the named argument style, as follows: cf.Http({method:"method", url:"url", username:"username", password:"password", resolveurl:"yes or no", params:arrayv...
Page 1106
1106 chapter 10: coldfusion actionscript functions cf.Http(method, url, username, password); cf.Http(method, url, params, username, password); note: do not use curly braces {} with positional arguments. The following parameters can only be passed as an array of objects in the params argument in the ...
Page 1107
Cf.Http 1107 you access these attributes using the get function: function basicget() { url = "http://localhost:8100/"; // invoke with just the url. This is an http get. Result = cf.Http(url); return result.Get("filecontent"); } note: for more information on using server-side actionscript, see chapte...
Page 1108
1108 chapter 10: coldfusion actionscript functions { url = "http://localhost:8100/"; // invoke with just the url. This is an http get. Result = cf.Http(url); return result.Get("filecontent"); } // example showing simple array created to pass params arguments function postwithparams() { // set up the...