background image

cfinvokeargument

213

cfinvokeargument

Description

Passes the name and value of a parameter to a component method or a web service. This tag is 
used within the 

cfinvoke

 tag. 

Category

Extensibility tags

Syntax

<cfinvokeargument

name="argument name"
value="argument value">

See also

cfargument

cfcomponent

cffunction

cfinvoke

cfobject

cfproperty

cfreturn

History

ColdFusion MX: Added this tag.

Attributes

Usage

You can have multiple 

cfinvokeargument

 tags in a 

cfinvoke

 tag body.

You can use 

cfinvokeargument

 tag to dynamically determine the arguments to be passed. For 

example, you can use conditional processing to determine the argument name, or you can use a 

cfif

 tag to determine whether to execute the 

cfinvokeargument

 tag.

Example1

<cfinvoke 

component="nasdaq.quote" 
method="getLastTradePrice"
returnVariable="res">

<cfinvokeargument 

name="symbol" value="mot">

<cfinvokeargument 

name="symbol" value="macr">

</cfinvoke>

<cfoutput>#res#</cfoutput>

Example2

<cfinvoke

webservice ="http://www.xmethods.net/sd/2001/BabelFishService.wsdl"
method ="BabelFish"
returnVariable = "varName"
>
<cfinvokeargument 

name="translationmode" value="en_es">

<cfinvokeargument 

Attribute

Req/Opt

Default

Description

name

Required

Argument name

value

Required

Argument value

Содержание COLDFUSION MX 61-CFML

Страница 1: ...CFML Reference...

Страница 2: ...dia Inc or other entities and may be registered in certain jurisdictions including internationally This product includes code licensed from RSA Data Security This guide contains links to third party w...

Страница 3: ...tion and session variables 23 Custom tag variables 24 Request variable 24 Form variable 24 ColdFusion tag specific variables 24 ColdFusion query variables 25 CFCATCH variables 25 CFDIRECTORY variables...

Страница 4: ...ol tags 40 Forms tags 40 Internet Protocol tags 41 Page processing tags 41 Variable manipulation tags 41 Other tags 41 Tag changes since ColdFusion 5 42 New tags attributes and values 42 Deprecated ta...

Страница 5: ...nection File and directory operations 141 cfftp action listDir 145 cffunction 146 cfgraph 149 cfgraphdata 151 cfgrid 152 How data is returned from cfgrid 156 Using the href attribute 158 cfgridcolumn...

Страница 6: ...foutput 263 cfparam 265 cfpop 267 cfprocessingdirective 271 cfprocparam 274 cfprocresult 278 cfproperty 280 cfquery 282 cfqueryparam 286 cfregistry 290 cfregistry action getAll 291 cfregistry action g...

Страница 7: ...List functions 369 Mathematical functions 370 Other functions 370 Query functions 370 String functions 370 Structure functions 371 System functions 371 XML functions 371 Function changes since ColdFu...

Страница 8: ...reateObject object types 423 CreateObject COM object 424 CreateObject component object 425 CreateObject CORBA object 426 CreateObject Java or EJB object 428 CreateObject web service object 429 CreateO...

Страница 9: ...483 GetCurrentTemplatePath 484 GetDirectoryFromPath 485 GetEncoding 487 GetException 488 GetFileFromPath 489 GetFunctionList 490 GetHttpRequestData 491 GetHttpTimeString 493 GetK2ServerDocCount 494 G...

Страница 10: ...540 IsObject 541 IsProtected 543 IsQuery 544 IsSimpleValue 545 IsStruct 546 IsUserInRole 548 IsWDDX 549 IsXmlDoc 551 IsXmlElem 552 IsXmlRoot 553 JavaCast 554 JSStringFormat 556 LCase 557 Left 558 Len...

Страница 11: ...TimeFormat 621 LTrim 623 Max 624 Mid 625 Min 626 Minute 627 Month 628 MonthAsString 629 Now 630 NumberFormat 631 ParagraphFormat 634 ParameterExists 635 ParseDateTime 636 Pi 638 PreserveSingleQuotes 6...

Страница 12: ...3 StructCount 697 StructDelete 698 StructFind 700 StructFindKey 701 StructFindValue 702 StructGet 703 StructInsert 705 StructIsEmpty 707 StructKeyArray 708 StructKeyExists 710 StructKeyList 711 Struct...

Страница 13: ...GetRowCount 755 CCFXQuery SetData 756 CCFXRequest class 757 Class members 757 CCFXRequest AddQuery 758 CCFXRequest AttributeExists 759 CCFXRequest CreateStringSet 759 CCFXRequest Debug 760 CCFXRequest...

Страница 14: ...778 getAttribute 778 getAttributeList 779 getIntAttribute 779 getQuery 780 getSetting 780 Response interface 782 Methods 782 addQuery 782 setVariable 783 write 784 writeDebug 784 Debugging classes ref...

Страница 15: ...Contents 15 setField 796 wddxSerialize 797 CHAPTER 7 ColdFusion ActionScript Functions 799 CF query 800 CF http 801...

Страница 16: ...16 Contents...

Страница 17: ...ow to manage the ColdFusion environment including connecting to your data sources and configuring security for your applications Part II describes Verity search tools and utilities that you can use fo...

Страница 18: ...ine documentation All ColdFusion MX documentation is available online in HTML and Adobe Acrobat Portable Document Format PDF files Go to the documentation home page for ColdFusion MX on the Macromedia...

Страница 19: ...d Variables This chapter provides information on ColdFusion reserved words and lists scope variables Contents Reserved words 20 Scope specific built in variables 22 ColdFusion tag specific variables 2...

Страница 20: ...l of the following are reserved words IS Is iS and is Reserved words in forms You must also not create form field names ending in any of the following except to specify a form field validation rule us...

Страница 21: ...O GOTO GRANT GROUP HAVING HOUR IDENTITY IMMEDIATE IN INDICATOR INITIALLY INNER INPUT INSENSITIVE INSERT INT INTEGER INTERSECT INTERVAL INTO IS ISOLATION JOIN KEY LANGUAGE LAST LEADING LEFT LEVEL LIKE...

Страница 22: ...les TIME TIMESTAMP TIMEZONE_ HOUR TIMEZONE_ MINUTE TO TRAILING TRANSACTION TRANSLATE TRANSLATION TRIM TRUE UNION UNIQUE UNKNOWN UPDATE UPPER USAGE USER USING VALUE VALUES VARCHAR VARYING VIEW WHEN WHE...

Страница 23: ...orts the Variables scope Unscoped variables created with the cfset tag acquire the Variables scope by default For example the variable created by the statement CFSET linguist Chomsky can be referenced...

Страница 24: ...Request variables store data about the processing of one page request Request variables store data in a structure that can be passed to nested tags such as custom tags and processed once To provide i...

Страница 25: ...CFCATCH Detail CFCATCH ErrNumber CFCATCH NativeErrorCode CFCATCH SQLState CFCATCH LockName CFCATCH LockOperation CFCATCH MissingFileName CFCATCH TagContext CFCATCH ErrorCode CFCATCH ExtendedInfo CFDIR...

Страница 26: ...FERROR Diagnostics CFERROR Mailto or CFERROR DateTime CFFILE ACTION Upload variables File variables are read only Use the CFFILE prefix to reference file variables for example CFFILE ClientDirectory T...

Страница 27: ...th row queryname LastModified row queryname Attributes queryname IsDirectory queryname Mode CFHTTP variables A cfhttp get operation can return text and binary files Files are downloaded and the conten...

Страница 28: ...e cfstoredproc tag returns the following variables CFSTOREDPROC ExecutionTime CFSTOREDPROC StatusCode CFREGISTRY variables The cfregistry tag returns a query record set that you can reference after ex...

Страница 29: ...CEPT CGI HTTP_IF_MODIFIED_SINCE CGI HTTP_USER_AGENT The CERT_ISSUER CERT_SUBJECT CLIENT_CERT_ENCODED variables are available only when you use client certificates CGI environment variables When a brow...

Страница 30: ...the information protocol this request came in with Format protocol revision SERVER_PORT Port number to which the request was sent REQUEST_METHOD Method with which the request was made For HTTP this i...

Страница 31: ...mat software version library version HTTP_IF_MODIFIED_SINCE The last time the page was modified The browser determines whether to set this variable usually in response to the server having sent the LA...

Страница 32: ...32 Chapter 1 Reserved Words and Variables...

Страница 33: ...interact with data sources manipulate data and display output CFML tag syntax is similar to HTML element syntax This chapter contains categorized and alphabetical lists of the tags followed by the det...

Страница 34: ...ches exceptions in ColdFusion pages cfchart Data output tags Generates and displays a chart cfchartdata Data output tags Defines chart data points cfchartseries Data output tags Defines style in which...

Страница 35: ...a grid row used with cfgrid cfgridupdate Forms tags Directly updates ODBC data source from edited grid data cfheader Data output tags Page processing tags Generates HTTP headers cfhtmlhead Forms tags...

Страница 36: ...ternet Protocol tags Attaches a file or adds a header to an e mail message cfmailpart Forms tags Internet Protocol tags Contains one part of a multi part mail message cfmodule Application framework ta...

Страница 37: ...Forms tags Creates a drop down list box form element used in cfform tag cfset Variable manipulation tags Defines a variable cfsetting Other tags Variable manipulation tags Defines and controls ColdFu...

Страница 38: ...dling tags Flow control tags Catches exceptions in ColdFusion pages cfupdate Database manipulation tags Updates rows in a database data source cfwddx Extensibility tags Serializes and de serializes CF...

Страница 39: ...ags 40 Internet Protocol tags 41 Page processing tags 41 Variable manipulation tags 41 Other tags 41 Application framework tags Database manipulation tags Data output tags Debugging tags cfapplication...

Страница 40: ...rt cfcollection cfinvokeargument cfreturn cfcomponent cflogin cfsearch cfexecute cfloginuser cfwddx cfftp cflogout cfxml cfdirectory cffile cfftp cfabort cfexecute cfrethrow cfbreak cfexit cfswitch cf...

Страница 41: ...ble manipulation tags Other tags cfftp cfldap cfmailpart cfhttp cfmail cfpop cfhttpparam cfmailparam cfcache cfheader cfsetting cfcontent cfhtmlhead cfsilent cfflush cfinclude cfcookie cfregistry cfse...

Страница 42: ...MX cfcache timespan attribute ColdFusion MX cachedirectory attribute ColdFusion MX cfchart All ColdFusion MX cfchartdata All ColdFusion MX cfchartseries All ColdFusion MX cfcollection list value of ac...

Страница 43: ...userName attribute ColdFusion MX 6 1 password attribute ColdFusion MX 6 1 wrapText attribute ColdFusion MX 6 1 cfmailparam type attribute ColdFusion MX 6 1 cfmailpart All ColdFusion MX 6 1 cfobject Al...

Страница 44: ...raph All ColdFusion MX cfgraphdata All ColdFusion MX cfgridupdate connectString attribute ColdFusion MX dbName attribute ColdFusion MX dbServer attribute ColdFusion MX dbType attribute ColdFusion MX p...

Страница 45: ...rnal attribute ColdFusion MX cfservlet All ColdFusion MX cfservletparam All ColdFusion MX cfslider img attribute ColdFusion MX imgStyle attribute ColdFusion MX grooveColor attribute ColdFusion MX cfst...

Страница 46: ...r than ColdFusion 5 Tag Attribute or value Obsolete as of this ColdFusion release cfauthenticate All ColdFusion MX cfimpersonate All ColdFusion MX cfindex action attribute value optimize ColdFusion MX...

Страница 47: ...g with the showError attribute but do not define an error page using cferror page processing stops when the cfabort tag is reached The message in showError displays to the client When you use this tag...

Страница 48: ...value cfloop from 1 to 4 index Counter on the second time through the loop cfabort cfif Counter is 2 cfabort processing is stopped and subsequent operations are not carried out cfelse cfset myVariabl...

Страница 49: ...ported message_to_display_for_nonJava_browser param_1 applet_parameter_name param_2 applet_parameter_name param_n applet_parameter_name See also cfform cfobject cfservlet History ColdFusion MX Removed...

Страница 50: ...tensions section p This example applet copies text that you type into a form Type some text and then click copy to see the copied text cfform action index cfm cfapplet appletsource copytext name copyt...

Страница 51: ...vailable Server Session and Application scope variables are stored in memory as structures In earlier releases only Session and Application scope variables were stored this way You cannot access the U...

Страница 52: ...datasource_name in ODBC or native data source You must create storage repository in the Administrator registry in the system registry cookie on client computer in a cookie Scalable If client disables...

Страница 53: ...ionvariables This tag is placed in a special file calledApplication cfm that is run before any other CF page in a directory where the Application cfm file appears cfapplication name ETurtle sessionTim...

Страница 54: ...e data type of the argument any array binary boolean date guid The argument must be a UUID or GUID of the form xxxxxxxx xxxx xxxx xxxx xxxxxxxxxxxx where each x is a character representing a hexadecim...

Страница 55: ...description from the database cfquery name Description datasource cfsnippets SELECT Descript FROM Courses WHERE Number Course_Number cfquery Specify the variable that the function returns cfreturn Des...

Страница 56: ...is appended to an array whose name is thistag collectionName Within the custom tag code the attributes passed to the tag by using the attributeCollection attribute are saved as independent values wit...

Страница 57: ...s obsolete Use the newer security tools see Authentication functions on page 367 and Chapter 16 Securing Applications in Developing ColdFusion MX Applications History ColdFusion MX this tag is obsolet...

Страница 58: ...a query to find a value In our example a list of values corresponding to courses in the Snippets datasource When the conditions of the query are met CFBREAK stops the loop p Please enter a Course Numb...

Страница 59: ...and cachedirectory attributes They might not work and might cause an error in later releases Added the timespan attribute Changed how pages are cached the default action attribute value cache caches...

Страница 60: ...on servercache server side caching only Not recommended optimal same as cache directory Optional cf_root cache Absolute path of cache directory timespan Optional Page is flushed only whencfcache actio...

Страница 61: ...rsonalized copy of a page for other users Debug settings have no effect on cfcache unless the application page enables debugging When generating a cached file cfcache uses cfsetting showDebugOutput No...

Страница 62: ...he following line matches red blue or green cfcase value red blue green You can use the delimiter attribute to specify one or more delimiters to use in place of the comma For example the following lin...

Страница 63: ...lue 9 8 delimiters cfset grade B cfcase cfcase value 7 6 delimiters cfset grade C cfcase cfcase value 5 4 delimiters cfset grade D cfcase cfdefaultcase cfset grade F cfdefaultcase cfswitch cfoutput Yo...

Страница 64: ...value is the same as in ColdFusion 5 Type 4 100 Java no native methods the value might be different If your application depends on SQLSTATE values for flow control the application might produce unexpe...

Страница 65: ...example you could define a type as follows cfthrow type MyApp BusinessRuleException InvalidAccount If you have the following cfcatch tag it will handle the exception cfcatch type MyApp BusinessRuleExc...

Страница 66: ...type database Native error code associated with exception Database drivers typically provide error codes to diagnose failing database operations Default 1 cfcatch SQLState Applies to type database SQL...

Страница 67: ...Allaire ColdFusion HTTPContinue COM Allaire ColdFusion HTTPCookieValueNotPassed COM Allaire ColdFusion HTTPCreated COM Allaire ColdFusion HTTPFailure COM Allaire ColdFusion HTTPFileInvalidPath COM Al...

Страница 68: ...ColdFusion HTTPPaymentRequired COM Allaire ColdFusion HTTPPreconditionFailed COM Allaire ColdFusion HTTPProxyAuthenticationRequired COM Allaire ColdFusion HTTPRequestURITooLarge COM Allaire ColdFusion...

Страница 69: ...contents of the tag stack are p cfloop index i from 1 to ArrayLen CFCATCH TAGCONTEXT cfset sCurrent CFCATCH TAGCONTEXT i br i sCurrent ID sCurrent LINE sCurrent COLUMN sCurrent TEMPLATE cfloop cfoutp...

Страница 70: ...font size fontBold yes or no fontItalic yes or no labelFormat number currency percent date xAxisTitle title text yAxisTitle title text xAxisType scale or category yAxisType scale or category sortXAxi...

Страница 71: ...lies to charts that have more than one data series Relative positions of series default ColdFusion determines relative positions based on graph types cluster stacked percent foregroundColor black Colo...

Страница 72: ...and scale sortXAxis no yes display column labels in alphabetic order along X axis no Ignored if xAxisType attribute is scale show3D no yes display chart with three dimensional appearance no xOffset 0...

Страница 73: ...s or none showMarkers yes Applies to chartseries type attribute values line curve and scatter yes display markers at data points no markerSize Automatic Size of data point marker in pixels Integer pie...

Страница 74: ...following W3C HTML 4 named color value or hex values For all other color values you must enter the hex value For more color names that are supported by popular browsers see www w3 org TR css3 color Fl...

Страница 75: ...s data is submitted to the cfchartseries tag Category Data output tags Extensibility tags Syntax cfchartdata item text value number See also cfchart cfchartseries History ColdFusion MX Added this tag...

Страница 76: ...ColdFusion MX 6 1 Changed interpolation behavior the tag now interpolates data points on line charts with multiple series ColdFusion MX Added this tag Attributes Attribute Req Opt Default Description...

Страница 77: ...fchart tag seriesLabel Optional Text of data series label seriesColor Optional Color of the main element such as the bars of a chart For a pie chart the color of the first slice Hex value or supported...

Страница 78: ...ay No error is thrown Example This example shows the use of cfcol and cftable to align information returned from a query query selects information from cfsnippets data source cfquery name GetEmployees...

Страница 79: ...tEmployees startRow 1 colSpacing 3 HTMLTable colheaders each cfcol tag sets the width of a column in the table the header information and the text CFML for the cell cfcol header b ID b align Left widt...

Страница 80: ...ol such as Vspider or MKVDK Category Extensibility tags Syntax cfcollection action action collection collection_name path path_to_verity_collection language language name queryname See also cfexecute...

Страница 81: ...ete collection directories map creates a map to the collection It is not necessary to specify this value ColdFusion maps collections automatically optimize optimizes the structure and contents of the...

Страница 82: ...rs use code such as the following cfcollection action list name myCollections cfoutput query myCollections name br cfoutput To add content to a collection use cfindex To search a collection use cfsear...

Страница 83: ...se cfset collpath opt coldfusionmx verity collections cfif Process form input and do the requested cfcollection operation cfif IsDefined form CollectionName AND IsDefined form CollectionAction cfif fo...

Страница 84: ...f cfif Form to specify the collection name and action form action CGI SCRIPT_NAME method POST select name CollectionAction option value Create Create this collection option value Optimize Optimize thi...

Страница 85: ...A component method is invoked in the following ways Within the cfinvoke tag in a ColdFusion page Within a URL that calls a CFC file and passes a method name as a URL parameter Within the cfscript tag...

Страница 86: ...al Name of parent component from which to inherit methods and properties output Optional Component body displayable text is processed as standard CFML Specifies whether constructor code in the compone...

Страница 87: ...ge output Note This tag executes only if it is enabled in the ColdFusion Administrator For more information see Configuring and Administering ColdFusion MX Category Data output tags Syntax cfcontent t...

Страница 88: ...16 For example type text html type text html charset ISO 8859 1 deleteFile Optional No Applies only if you specify a file with the file attribute Yes deletes the file on the server after sending its c...

Страница 89: ...in the browser the browser displays the file without asking users whether to save it if you use a cfheader tag similar to the following cfheader name Content Disposition value filename filename ext F...

Страница 90: ...mple 2 h3 p This example shows how reset attribute changes output for text p p reset Yes 123 cfcontent type text html reset Yes 456 p p This example shows how reset attribute changes output for text p...

Страница 91: ...can include any printable ASCII characters except commas semicolons or white space characters value Optional Value to assign to cookie variable Must be a string or variable that can be stored as a str...

Страница 92: ...de use the following line cfoutput cookie person name cfoutput Example This example shows how to set delete a cfcookie variable Select users who have entered comments into sample database cfquery name...

Страница 93: ...e LastAOLVisitor value Email expires NOW cfif cfloop If the timeVisited cookie is not set set a value cfif IsDefined Cookie TimeVisited is False cfcookie name TimeVisited value Now expires 10 cfif cfi...

Страница 94: ...ntents of the cfdefaultcase tag body can include HTML and text and CFML tags functions variables and expressions You can specify only one cfdefaultcase tag within a cfswitch tag You can put the cfdefa...

Страница 95: ...irectory action list no longer returns the values of the Archive and System attributes On UNIX and Linux cfdirectory action list does not return any information in the mode column Attributes Attribute...

Страница 96: ...pplicable mode Empty column retained for backward compatibility with ColdFusion 5 applications on UNIX You can use the following result columns in standard CFML expressions preceding the result column...

Страница 97: ...e case sensitive The following 2 characters have special meaning in the pattern and are called metacharacters matches any zero or more characters matches any single character The following table shows...

Страница 98: ...rmation for the object Attributes Usage The expand contract display capability is useful when working with large structures such as XML document objects structures and arrays To display a construct us...

Страница 99: ...le cell is empty this tag displays empty string Example This example shows how to use this tag to display a URL variable URL variables contain parameters that are passed in a URL string in a page requ...

Страница 100: ...ression HTML and CFML tags cfelse HTML and CFML tags cfif See also cfif cfelseif cfabort cfbreak cfexecute cfexit cflocation cfloop cfswitch cfthrow cftry Usage If the values of the expressions in the...

Страница 101: ...e cfexit cflocation cfloop cfswitch cfthrow cftry Usage If the value of the expression in this tag is true and the values of the expressions in the containing cfif tag and preceding cfelseif tags are...

Страница 102: ...custom error page in Developing ColdFusion MX Applications exception a exception of the type specified by the exception attribute validation errors recognized by sever side type validation request an...

Страница 103: ...xception condition Uses the full range of CFML tags Error variables must be in cfoutput tags Can handle specific exception types or display general information for exceptions Request Includes the erro...

Страница 104: ...template request_err cfm mailTo admin mywebsite com Example of the page to handle this error html head title We re sorry An Error Occurred title head body Request and Exception error diagnostics Detai...

Страница 105: ...please contact error mailTo with the following information p p ul li b Your Location b error remoteAddress li b Your Browser b error browser li b Date and Time the Error Occurred b error dateTime li b...

Страница 106: ...an extension for example C myapp exe arguments Optional Command line variables passed to application If specified as string it is processed as follows Windows passed to process control subsystem for p...

Страница 107: ...s output in a file cfexecute name C WinNT System32 netstat exe arguments e outputFile C Temp output txt timeout 1 cfexecute variable Optional Variable in which to put program output If no outputfile o...

Страница 108: ...on its location and execution mode Example h3 cfexit Example h3 p cfexit can be used to abort the processing of the currently executing CFML custom tag Execution resumes following the invocation of t...

Страница 109: ...the expected attribute variables is not present an error message is generated and cfexit returns control to the calling page cfif NOT IsDefined attributes myValue2 cfset caller result Value2 is not de...

Страница 110: ...g syntax depends on the action attribute value See the following sections See also cfdirectory History ColdFusion MX 6 1 Changed file path requirements if you do not specify an absolute file path the...

Страница 111: ...ew file cffile action Write file GetTempDirectory foobar txt output form the_text cfif cfif form action is read read existing file cffile action Read file GetTempDirectory foobar txt variable readText...

Страница 112: ...s depending on whether the file exists select name action cfif fileExists is no option value new Make new file cfif cfif fileExists is yes option value add Add to existing file option value delete Del...

Страница 113: ...file to which to append content of output attribute If not an absolute path starting a with a drive letter and a colon or a forward or backward slash it is relative to the ColdFusion temporary directo...

Страница 114: ...maintained Each value must be specified explicitly For example if you specify attributes readOnly all other attributes are overwritten readOnly hidden normal charset Optional JVM default file charact...

Страница 115: ...nd a colon or a forward or backward slash it is relative to the ColdFusion temporary directory which is returned by the GetTempDirectory function destination Required Pathname of a directory or file o...

Страница 116: ...d file cffile action delete file c files upload Variables DeleteFileName Attribute Req Opt Default Description action Required Type of file manipulation that the tag performs file Required Pathname of...

Страница 117: ...ired Pathname of the file to move If not an absolute path starting a with a drive letter and a colon or a forward or backward slash it is relative to the ColdFusion temporary directory which is return...

Страница 118: ...he file If omitted the file s attributes are maintained Each value must be specified explicitly For example if you specify attributes readOnly all other attributes are overwritten readOnly hidden norm...

Страница 119: ...Type of file manipulation that the tag performs file Required Pathname of the file to read If not an absolute path starting a with a drive letter and a colon or a forward or backward slash it is relat...

Страница 120: ...ulating the contents of text files You can also use the variable that is created by a cffile action read operation in the ArrayToList and ListToArray functions Note If you use this tag to read a file...

Страница 121: ...ame variable var_name See also cfdirectory Attributes Usage You convert the binary file to Base64 to transfer it to another site Example The following example creates a variable named aBinaryObj to co...

Страница 122: ...ed Pathname of file to rename If not an absolute path starting a with a drive letter and a colon or a forward or backward slash it is relative to the ColdFusion temporary directory which is returned b...

Страница 123: ...cffile 123 cffile action rename source c files memo keymemo doc destination c files memo oldmemo doc...

Страница 124: ...to upload the file If not an absolute path starting a with a drive letter and a colon or a forward or backward slash it is relative to the ColdFusion temporary directory which is returned by the GetT...

Страница 125: ...s to Windows A comma delimited list of attributes to set on the file If omitted the file s attributes are maintained Each value must be specified explicitly For example if you specify attributes readO...

Страница 126: ...file tmp foo mode 644 output some text This example appends to a file and sets permissions to read write rw for all cffile action append destination home tomj testing txt mode 666 output Is this a tes...

Страница 127: ...e manipulation that the tag performs file Required Pathname of the file to write If not an absolute path starting a with a drive letter and a colon or a forward or backward slash it is relative to the...

Страница 128: ...eates the file tmp foo with permissions rw r r owner read write group read other read cffile action write file tmp foo mode 644 This example appends to the file and sets permissions to read write rw f...

Страница 129: ...stination home tomj testing txt mode 666 output Is this a test This example uploads a file and gives it the permissions owner group other read write execute cffile action upload fileField fieldname de...

Страница 130: ...cfcontent cfcookie cfform cfheader cfhtmlhead cflocation and SetLocale These tags and functions normally modify the HTML header but cannot do so after a cfflush tag because the cfflush sends the head...

Страница 131: ...you will agree it was worth the short wait H2 cfflush cfflush interval 10 Delay Loop to make it seem harder cfloop index randomindex from 1 to 200000 step 1 cfset random rand cfloop Now slowly output...

Страница 132: ...es cfform See also cfapplet cfgrid cfinput cfselect cfslider cftextinput cftree cftreeitem History ColdFusion MX Deprecated the enableCAB attribute It might not work and might cause an error in later...

Страница 133: ...page 312 cftree controls Overrides the cftreeitem expand attribute If true expands previously selected elements The cftree completePath attribute must be set to Yes cfgrid controls has no effect This...

Страница 134: ...ignored If you specify a value in quotation marks you must escape them by doubling them for example passThrough readonly Yes Any form field name from the cfform tag or an HTML form that ends in one of...

Страница 135: ...is True AND form textSample is not h3 Results of Credit Card Input h3 Your credit card number cfoutput form textSample cfoutput was valid under the MOD 10 algorithm cfif cfif IsDefined form sampleSlid...

Страница 136: ...example from 1 to 10 by sliding control p 1 cfslider name sampleSlider label Sample Slider range 1 10 message Please enter a value from 1 to 10 scale 1 bold No italic No refreshlabel No 10 td tr tabl...

Страница 137: ...ot work and might cause an error in later releases Usage Use this tag to move files between a ColdFusion server and an FTP server This tag does not move files between a ColdFusion server and a client...

Страница 138: ...ed if action open User name to pass in the FTP operation password Required if action open Password to log in the user server Required if action open FTP server to which to connect for example ftp myse...

Страница 139: ...to Session or Application variable the connection remains open for the current page only and you do not have to close it manually Changes to a cached connection such as changing retryCount or timeout...

Страница 140: ...topOnError Yes name ListFiles directory connection my_query cfoutput query ListFiles name br cfoutput p Close the connection cfftp action close connection My_query stopOnError Yes p Did it succeed cfo...

Страница 141: ...me new file or directory name proxyServer proxy server passive Yes or No See also cfhttp cfldap cfmail cfpop Attributes Attribute Req Opt Default Description action Required if connection is not cache...

Страница 142: ...auto transferMode Optional Auto ASCII FTP transfer mode Binary FTP transfer mode Auto FTP transfer mode failIfExists Optional Yes Yes if a local file with same name exists getFile fails No directory R...

Страница 143: ...myConnection username myUserName password myUserName allaire com server ftp allaire com action open stopOnError Yes p Did it succeed cfoutput cfftp succeeded cfoutput cfftp connection myConnection act...

Страница 144: ...144 Chapter 2 ColdFusion Tags action close stopOnError Yes p Did it succeed cfoutput cfftp succeeded cfoutput...

Страница 145: ...he row number of each file directory entry returned by the listDir operation A separate row is created for each entry Note Previously supported query column values that pertain to system specific info...

Страница 146: ...rwise any String a type name data type of the function return value any array binary boolean date guid The argument must be a UUID or GUID of the form xxxxxxxx xxxx xxxx xxxx xxxxxxxxxxxx where each x...

Страница 147: ...ge public available to a locally executing page or component method remote available to a locally or remotely executing page or component method or a remote client through a URL Flash or a web service...

Страница 148: ...for the returnType attribute the function must return a string that is in ColdFusion variable name format that is the function must return a string that starts with a letter underscore or Unicode curr...

Страница 149: ...Sets item label text font If the Valuelabelfont Itemlabelfont and Legendfont values differ ColdFusion uses the last value that you specify in the tag Arial is not supported it is mapped to Dialog Leg...

Страница 150: ...slabel selected series row value or an empty string javascript executes client side scripts Urlcolumn Ignored This attribute generates a graph but the url link is missing data that the linked page may...

Страница 151: ...deprecated Use the cfchart cfchartdata and cfchartseries tags instead Displays a data point in a graph Used within the cfgraph tag History ColdFusion MX Deprecated this tag It works differently than i...

Страница 152: ...Yes or No bold Yes or No textColor web color href URL hrefKey column_name target URL_target appendKey Yes or No highlightHref Yes or No onValidate javascript_function onError text gridDataAlign positi...

Страница 153: ...mn widths so that all columns display within grid width No sets columns to equal widths User can resize columns Horizontal scroll bars are not available because if you specify a column width and set a...

Страница 154: ...onal URL o r query column name that contains a URL to hyperlink each grid cell with hrefKey Optional The query column to use for the value appended to the href URL of each cell instead of the cell s v...

Страница 155: ...derTextColor Optional Black Text color of grid control row headers Options same as for textColor attribute colHeaders Optional see description Yes Yes displays column headers in grid control No colHea...

Страница 156: ...a returned falls into one of these categories Simple data returned from simple select operations Complex data returned from insert update and delete operations selectMode Optional Browse Selection mod...

Страница 157: ...ather the data from the form variables the tag collects data writes SQL calls and updates the data source If you cannot use cfgridupdate if for example you must distribute the returned data to more th...

Страница 158: ...appended to the URL The value of selection is determined by the value of the selectMode attribute If selectMode Single selection is the value of the column clicked If selectMode Row selection is a de...

Страница 159: ...rowHeaderBold No colHeaders Yes colHeaderAlign LEFT colHeaderItalic No colHeaderBold No selectColor Red selectMode EDIT pictureBar No insertButton To insert deleteButton To delete sortAscendingButton...

Страница 160: ...160 Chapter 2 ColdFusion Tags html...

Страница 161: ...aderTextColor web color dataAlign position headerAlign position numberFormat format values Comma separated strings and or numeric range valuesDisplay Comma separated strings and or numeric range value...

Страница 162: ...e textColor C2 LT 0 red pink This means If value in Column 2 is less than 0 display value in red otherwise display value in pink See Using expressions in textColor and bgColor attributes on page 164 A...

Страница 163: ...lays as check box if cell is editable user can change checkmark string_noCase user can sort grid data as case insensitive text headerFont Optional as specified by cfgrid Column header font headerFontS...

Страница 164: ...condition Value for textColor if condition evaluates to false If the string in the expression can be interpreted as a number the comparisons in the expression are interpreted as numeric Otherwise the...

Страница 165: ...placeholder Period Location of mandatory decimal point 0 Located to left or right of mandatory decimal point pads with zeros Puts parentheses around mask if number is less than 0 Puts plus sign befor...

Страница 166: ...mn NAME City header City cfgridcolumn NAME Country header Country cfloop index Counter from 1 to ListLen MyList1 cfgridrow data ListGetAt MyList1 Counter ListGetAt MyList2 Counter cfloop cfgrid cfform...

Страница 167: ...olor red selectmode edit picturebar no insertbutton to insert deletebutton to delete sortascendingbutton sort asc sortdescendingbutton sort desc cfgridcolumn name Dept_ID header Department headeralign...

Страница 168: ...lumn name Dept_ID header Department headeralign left dataalign left bold yes italic no select yes display yes headerbold no headeritalic yes cfgridcolumn name CorNumber header Course headeralign left...

Страница 169: ...et cfform cfinput cfselect cfslider cftextinput cftree History ColdFusion MX Deprecated the connectString dbName dbServer dbtype provider and providerDSN attributes They do not work and might cause an...

Страница 170: ...ined form gridEntered is True cfgridupdate grid FirstGrid dataSource cfsnippets tableName CourseList keyOnly Yes cfif tableQualifier Optional Table qualifier if supported Purpose SQL Server and Oracle...

Страница 171: ...Content Disposition uses the default file character encoding to encode this header s value so the name of a file can include characters in the character encoding used in the file Attributes Attribute...

Страница 172: ...ple h3 p cfheader generates custom HTTP response headers to return to the client p This example forces browser client to purge its cache of requested file cfheader name Expires value Now statusCode Re...

Страница 173: ...page an error is thrown Example body This example shows the use of cfhtmlhead cfhtmlhead text meta name Description content This is an example of a generated header p cfhtmlhead writes the text speci...

Страница 174: ...me name queryname columns query_columns firstrowasheaders yes or no delimiter character textQualifier character cfhttpparam tags optional for some methods cfhttp See also cfhttpparam GetHttpRequestDat...

Страница 175: ...nformation to the server for processing Requires one or more cfhttpparam tags Often used for submitting form like data PUT Requests the server to store the message body at the specified URL Use this m...

Страница 176: ...luding the URL query string and form or file data and the response The following list includes commonly used values utf 8 iso 8859 1 windows 1252 us ascii shift_jis iso 2022 jp euc jp euc kr big5 euc...

Страница 177: ...ter for example RequestTime 120 ColdFusion uses the lesser of the URL timeout and the timeout attribute value this ensures that the request times out before or at the same time as the page If the URL...

Страница 178: ...ldFusion uses the multipart form data content type for all parts If Yes ColdFusion also sends the request s charset in each Content Type description All form field data must be encoded in this charact...

Страница 179: ...attribute and the firstrowasHeader attribute is true the default the column names specified by this attribute replace the first line of the response You can use this behavior to replace the column nam...

Страница 180: ...r encoding specified by the response Content Type header cfhttp errorDetail If the connection to the HTTP server fails contains details about the failure For instance Unknown host my co com otherwise...

Страница 181: ...attribute and set firstrowasheaders No ColdFusion generates column names of the form Column_1 Column2 etc The cfhttp tag checks to ensure that column names in the data returned by the tag start with a...

Страница 182: ...ddress method GET resolveurl Yes throwOnError Yes Parse the xml and output a list of resources cfset xmlDoc XmlParse CFHTTP FileContent Get the array of resource elements the xmlChildren of the xmlroo...

Страница 183: ...pparam type transaction type name data name value data value file filename encoded Yes or No mimeType MIME type designator See also cfhttp GetHttpRequestData cfftp cfldap cfmail cfmailparam cfpop Hist...

Страница 184: ...o append to the cfhttp url attribute ColdFusion URL encodes the query string FormField Specifies a form field to send ColdFusion URL encodes the Form field by default Cookie Specifies a cookie to send...

Страница 185: ...ldnames key list depends on the position of the cfhttpparam tag with the file relative to the cfhttp tags with the form data URL encoding preserves special characters such as the ampersand when they a...

Страница 186: ...186 Chapter 2 ColdFusion Tags br CGI variable CGI cgi_test br br Note that the CGI variable is URL encoded cfoutput...

Страница 187: ...s a Boolean you do not have to define the True condition explicitly This example uses the IsArray function cfif IsArray myarray If successful IsArray evaluates to Yes the string equivalent of the Bool...

Страница 188: ...fif Trim City is San Diego OR Trim City is Santa Ana h4 Featured Center in cfif Trim City is San Diego San Diego cfelse Santa Ana cfif h4 b Name Address b Name Address1 City State br b Contact b Conta...

Страница 189: ...s obsolete Use the newer security tools see Authentication functions on page 367 and Chapter 16 Securing Applications in Developing ColdFusion MX Applications History ColdFusion MX This tag is obsolet...

Страница 190: ...edence Attribute Req Opt Default Description taglib Required Tag library URI The path must be relative to the web root and start with the current page location or a directory specified in the Administ...

Страница 191: ...must be on the page that uses the imported tags For example if you use a cfimport tag on a page that you include with the cfinclude call you cannot use the imported tags on the page that has the cfinc...

Страница 192: ...page 2 In directories mapped in the ColdFusion Administrator for the included file The included file must be a syntactically correct and complete CFML page For example to output data from within the...

Страница 193: ...1 custom_value custom2 custom_value URLpath URL extensions file_extensions query query_name recurse Yes or No language language See also cfcollection cfexecute cfobject cfreport cfsearch cfwddx Histor...

Страница 194: ...y name Permits searching collections by title or displaying a separate title from the key key Depends on action attributevalue see Usage section empty string Absolute path and filename if type file Ab...

Страница 195: ...ppropriate European or Asian Verity Locales language pack Specifying this attribute is required optional or unnecessary blank For this action attribute value purge delete update or refresh collection...

Страница 196: ...2 custom2 for ACTION UPDATE 2 TYPE FILE key is a query result set column cfquery name bookquery datasource book select from book where bookid file cfquery cfoutput query bookquery url description br c...

Страница 197: ...n snippets action update type path key c inetpub wwwroot cfdocs snippets urlpath http localhost cfdocs snippets custom1 custom1 custom2 custom2 recurse no extensions for ACTION UPDATE 6 TYPE PATH wher...

Страница 198: ...root cfdocs snippets urlpath http localhost cfdocs snippets custom1 custom1 custom2 custom2 recurse yes extensions htm html cfm cfml cflock ACTION REFRESH 3 TYPE CUSTOM cfquery name book datasource bo...

Страница 199: ...m recurse no cflock ACTION DELETE 4 TYPE PATH key is a query result set column cflock name verity timeout 60 cfquery name bookquery datasource book select from book where bookid path1 cfquery cfoutput...

Страница 200: ...200 Chapter 2 ColdFusion Tags for ACTION PURGE cflock name verity timeout 60 cfindex action purge collection snippets cflock...

Страница 201: ...ext entry have 13 16 digits ColdFusion MX Changed the cfform tag preserveData attribute behavior if it is set to True ColdFusion checks radio and check box values only if their value matches the poste...

Страница 202: ...ucceeds and False otherwise If used the validate attribute is ignored pattern Required if validate regular_ expression JavaScript regular expression pattern to validate input Omit leading and trailing...

Страница 203: ...or information on using JavaScript regular expressions with this tag see Chapter 27 Building Dynamic Forms in Developing ColdFusion MX Applications Example this example shows the use of cfinput within...

Страница 204: ...204 Chapter 2 ColdFusion Tags message Enter a correctly formatted date dd mm yy validate date required No input type Submit name value send my information cfform...

Страница 205: ...se sensitive Must be the same case used when table was created tableOwner Optional For data sources that support table ownership such as SQL Server Oracle and Sybase SQL Anywhere use this field to spe...

Страница 206: ...fquery name GetComments dataSource cfsnippets SELECT CommentID EMail FromUser Subject CommtType MessText Posted Processed FROM Comments cfquery html head head h3 cfinsert Example h3 p First show a lis...

Страница 207: ...cfinsert 207 input type hidden name posted value cfoutput Now cfoutput pre input type Submit name value insert my comment form...

Страница 208: ...ribute Category Extensibility tags Syntax Syntax 1 this syntax invokes a method of a component cfinvoke component component name or reference method method name returnVariable variable name argumentCo...

Страница 209: ...ntax shows instantiation with the cfobject tag This cfinvoke syntax applies to instantiating a web service with the cfobject tag and to instantiating a web service with the createobject function cfobj...

Страница 210: ...nistrator Web Services webservice Required The URL of the WSDL file for the web service timeout Optional The timeout for the web service request in seconds proxyServer Optional http proxyHost system p...

Страница 211: ...n attribute For example the params struct contains three keys a 1 b 1 c 1 The following call is evaluated as if the arguments were passed to the method in the order a 3 b 2 c 1 cfinvoke a 2 b 2 argume...

Страница 212: ...ing code in a ColdFusion page named wscfml cfm cfinvoke webservice http www xmethods net sd 2001 BabelFishService wsdl method BabelFish translationmode en_es sourcedata Hello world friend returnVariab...

Страница 213: ...ag to dynamically determine the arguments to be passed For example you can use conditional processing to determine the argument name or you can use a cfif tag to determine whether to execute the cfinv...

Страница 214: ...214 Chapter 2 ColdFusion Tags name sourcedata value Hello world friend cfinvoke cfoutput varName cfoutput...

Страница 215: ...ps secure multi_field_security_string separator separator_character delimiter delimiter_character See also cfftp cfhttp cfmail cfmailparam cfpop Chapter 23 Managing LDAP Directories in Developing Cold...

Страница 216: ...Requires dn name Required if action Query Name of LDAP query The tag validates the value timeout Optional 60 Maximum length of time in seconds to wait for LDAP processing maxRows Optional Maximum numb...

Страница 217: ...ype Optional replace How to process an attribute in a multi value list add appends it to any attributes delete deletes it from the set of attributes replace replaces it with specified attributes You c...

Страница 218: ...ColdFusion illegal characters are automatically mapped to the underscore character therefore column names in the query result set might not exactly match the names of the LDAP attributes For usage ex...

Страница 219: ...nn dc edu filter cn name attributes cn o title mail telephonenumber sort cn ASC Display results center table border 0 cellspacing 2 cellpadding 2 tr th colspan 5 cfoutput results recordCount matches f...

Страница 220: ...rd file This tag has no effect if you use it after the cfflush tag on a page Example h3 cflocation Example h3 p This tag redirects the browser to a web resource normally you would use this tag to go t...

Страница 221: ...y or exclusive CFML to be synchronized cflock See also cfapplication cfassociate cfmodule Chapter 15 Using Persistent Data and Locking in Developing ColdFusion MX Applications Attributes Attribute Req...

Страница 222: ...lay set or update variables in a shared scope use the scope attribute to identify the scope as Server Application or Session Deadlocks A deadlock is a state in which no request can execute the locked...

Страница 223: ...u can skip any pair of these lock unlock steps For example if you do not have to lock the Server scope you can skip Steps 3 and 4 Similar rules apply for named locks For more information see the follo...

Страница 224: ...ock for the application wide variable that keeps track of the number of turtlenecks sold For a more efficient but more complex way of handling Application scope locking see Developing ColdFusion MX Ap...

Страница 225: ...ld Please select color and size p table cellspacing 2 cellpadding 2 border 0 tr td Select a color td td select type Text name color option red option white option blue option turquoise option black op...

Страница 226: ...essage text to log log Optional If you omit the file attribute writes messages to standard log file Ignored if you specify file attribute Application writes to Application log normally used for applic...

Страница 227: ...specify No for the application attribute the corresponding entry in the list is empty You can disable cflog tag execution For more information see the ColdFusion Administrator Basic Security page The...

Страница 228: ...ntication information ColdFusion MX Added this tag Attributes Usage The body of this tag executes only if there is no logged in user When using application based security you put code in the body of t...

Страница 229: ...shed using a one way algorithm in the Authorization header ColdFusion gets the username from the web server and sets the cflogin password value to the empty string You can use these values in the cflo...

Страница 230: ...login remains in effect until the session expires or the user is logged out by the cflogin tag ColdFusion MX Added this tag Attributes Usage Used inside the cflogin tag to identify the authenticated...

Страница 231: ...cflogin cfloginuser Chapter 16 Securing Applications in Developing ColdFusion MX Applications History ColdFusion MX 6 1 Changed behavior if the Session scope is enabled a login remains in effect unti...

Страница 232: ...repeatedly until one or more conditions are met This tag supports the following types of loops cfloop index loop on page 233 cfloop conditional loop on page 235 cfloop looping over a query on page 23...

Страница 233: ...internal representation of floating point numbers Note The to value is evaluated once when the cfloop tag is encountered Any change to this value within the loop block or within the expression that ev...

Страница 234: ...is loop is as follows The loop index is 1 The loop index is 2 The loop index is 3 The loop index is 4 As before the value of j is decremented by one for each iteration but this does not affect the val...

Страница 235: ...ession cfloop See also cfabort cfbreak cfexecute cfexit cfif cflocation cfswitch cfthrow cftry Attributes Example The following example increments CountVar from 1 to 5 Set the variable CountVar to 0 c...

Страница 236: ...cfoutput br cfloop The cfloop tag also iterates over a record set with dynamic start and stop points This gets the next n sets of records from a query This example loops from the 10th through the 20th...

Страница 237: ...cfloop looping over a query 237 dataSource Library maxRows 5 SELECT TemplateName FROM Templates cfquery cfloop query TemplateName cfinclude template TemplateName cfloop...

Страница 238: ...er in the delimiters attribute in any order For example this loop processes commas colons and slashes as list delimiters cfloop index ListElement list John Paul George Ringo delimiters cfoutput ListEl...

Страница 239: ...he collection is referenced In the cfoutput section the name property of the file2 item is referenced for display Example This example uses a COM object to output a list of files In this example FFunc...

Страница 240: ...th query query_name group query_column groupcasesensitive yes or no startrow query_row maxrows max_msgs server serverspecs port port_id mailerid headerid timeout seconds spoolenable yes or no Optional...

Страница 241: ...enerated For example to send messages that give customers status updates Status of Order Number Order_ID replyto Optional Address es to which the recipient is directed to send replies failto Optional...

Страница 242: ...ify the MIME type query Optional Name of cfquery from which to draw data for message s Use this attribute to send more than one message or to send query results within a message group Optional Current...

Страница 243: ...essing Mail addresses can have any of the following forms port Optional TCP IP port on which SMTP server listens for requests normally 25 A value here overrides the Administrator mailerID Optional Col...

Страница 244: ...in the order they are listed until it connects to a server ColdFusion does not try to connect to a server that was unavailable in the last 60 seconds Example h3 cfmail Example h3 Delete the surroundin...

Страница 245: ...cfmail 245 p input type Submit name form...

Страница 246: ...le uses cfmailparam to attach files and add header to a message p cfmail from peter domain com To paul domain com Subject See Important Attachments and Reply Attribute Req Opt Default Description file...

Страница 247: ...lparam 247 cfmailparam name Importance value Hich Please review the new logo Tell us what you think cfmailparam file c work readme txt type text plain cfmailparam file c work logo gif type image gif c...

Страница 248: ...t contents cfmailpart cfmail History ColdFusion MX 6 1 Added this tag See also cfmail cfmailparam cfpop cfftp cfhttp cfldap cfcontent Wrap Chapter 35 Sending and Receiving E Mail in Developing ColdFus...

Страница 249: ...ssage h3 p You are reading this message as strong HTML strong p p Your mail reader handles HTML text p cfmailpart cfmail wraptext Optional Do not wrap text Specifies the maximum line length in charact...

Страница 250: ...the attributeCollection parameter ColdFusion now uses the name value that is within the attributeCollection parameter Earlier releases did not process this consistently Attributes Attribute Req Opt D...

Страница 251: ...fmodule Example h3 p This view only example shows use of cfmodule to call a custom tag inline p p This example uses a sample custom tag that is saved in myTag cfm in the snippets directory You can als...

Страница 252: ...HTMLCodeFormat CFMODULE NAME myTag X 3 attributeCollection attrCollection1 Y 4 cfoutput P The result cfoutput result cfoutput Call the tag using the short cut notation CF_myTag X 3 attributeCollectio...

Страница 253: ...Note On UNIX this tag does not support COM objects See also cfargument cfcomponent cffunction cfinvoke cfinvokeargument cfproperty cfreturn History ColdFusion MX Changed instantiation behavior this ta...

Страница 254: ...EView utility Note On UNIX this tag does not support COM objects Syntax cfobject type com action action class program_ID name text context context server server_name See also ReleaseComObject cfcollec...

Страница 255: ...br HR cfoutput Get the 3rd object in the collection cfset emp obj Item 3 cfoutput The last name in the third item is emp lastname br HR cfoutput Loop over all the objects in the collection p Looping t...

Страница 256: ...d component name but is all lower case If it does not find the file it looks for a file name that matches the component name exactly with the identical character casing Example separate instantiation...

Страница 257: ...rba java The other object types do not take the type attribute context Required ior ColdFusion uses Interoperable Object Reference IOR to access CORBA server nameservice ColdFusion uses naming service...

Страница 258: ...258 Chapter 2 ColdFusion Tags Example cfobject type corba context ior class c myobject ior name GetName...

Страница 259: ...mple code 2 Use the init method with appropriate arguments to call a constructor For example cfset ret myObj init arg1 arg2 Calling a public method on the object without first calling the init method...

Страница 260: ...creates the Weblogic Environment object which is used to get InitialContext The context object is used to look up the EJBHome interface The call to create results in getting an instance of stateless s...

Страница 261: ...xy object for a web service You can enter the absolute URL in this tag or refer to a web service that is entered in the ColdFusion Administrator To minimize potential code maintenance enter the web se...

Страница 262: ...he query cache Category Database manipulation tags Syntax cfobjectcache action clear See also cfobject History ColdFusion 5 Added this tag Attributes Attribute Req Opt Default Description action Requi...

Страница 263: ...groups or eliminates duplicate entries as specified by the grouping attribute values if any It also sets the query currentRow variable to the current row being processed If you nest cfoutput blocks t...

Страница 264: ...recordCount cfoutput total records in our query Using the maxRows parameter we are limiting our display to 4 rows p cfoutput query GetCourses maxRows 4 Dept_ID CorName CorLevel br cfoutput p The next...

Страница 265: ...e ColdFusion returns an error Attribute Req Opt Default Description name Required Name of parameter to test such as Client Email or Cookie BackgroundColor If omitted and if the parameter does not exis...

Страница 266: ...L pages Example This example shows how to use CFPARAM to define default values for page variables cfparam name storeTempVar default my default value cfparam name tempVar default my default value check...

Страница 267: ...HTML parts Changed the attachment name separator the TAB character is now the separator between attachment names in the attachments and attachmentfiles query fields if a message has multiple attachmen...

Страница 268: ...t of message numbers to get or delete Invalid message numbers are ignored Ignored if uid is specified uid UID or a comma delimited list of UIDs to get or delete Invalid UIDs are ignored attachment Pat...

Страница 269: ...s a tab separated list of all the attachment names The queryname attachments column contains a tab separated list of the locations of the attachment files Use the cffile tag to delete these temporary...

Страница 270: ...Server cfif IsDefined form server make sure server username are not empty cfif form server is not and form username is not cfpop server server username UserName password pwd action GETHEADERONLY name...

Страница 271: ...tive pageencoding page encoding literal string or cfprocessingdirective suppressWhiteSpace Yes or No pageEncoding page encoding literal string CFML tags cfprocessingdirective See also cfcol cfcontent...

Страница 272: ...multiple cfprocessingdirective tags in one page that specify the pageEncoding attribute they must all specify the same value if not ColdFusion throws an error If you specify only the pageencoding att...

Страница 273: ...space whitespaceSetting code to whose output the setting is applied cfprocessingdirective The suppresswhitespace attribute only affects code that you put between the cfprocessingdirective begin tag an...

Страница 274: ...ldFusion MX uses JDBC 2 2 and does not support named parameters Changed the maxLength attribute behavior it now applies to IN and INOUT parameter values Attributes Attribute Req Opt Default Descriptio...

Страница 275: ...ype Different database systems might support different subsets of this list See your DBMS documentation for information on supported parameter types CF_SQL_BIGINT CF_SQL_BIT CF_SQL_BLOB CF_SQL_CHAR CF...

Страница 276: ...pParam1 in out EmpTyp pParam2 in out DeptTyp pParam3 in integer pParam4 out varchar2 END foo_data CREATE OR REPLACE PACKAGE BODY Foo_Data AS PROCEDURE RefCurProc pParam1 in out EmpTyp pParam2 in out...

Страница 277: ...text ENAME cfcol header JOB text JOB cfcol header SALARY text SAL cfcol header DEPT NUMBER text DEPTNO cftable hr b The second result set b br cftable query rs2 colHeaders HTMLTable border 1 cfcol he...

Страница 278: ...rsor type which passes a parameter by reference Parameters that are passed this way can be allocated and deallocated from memory within the execution of one application To use reference cursors in pac...

Страница 279: ...output The output param value foo br cfoutput h3 The Results Information h3 cfoutput query RS1 name DATE_COL br cfoutput p cfoutput hr p Record Count RS1 recordCount p Columns RS1 columnList hr cfoutp...

Страница 280: ...name Must be a static value type Optional any A string identifies the property data type any array binary boolean date guid The argument must be a UUID or GUID of the form xxxxxxxx xxxx xxxx xxxx xxxx...

Страница 281: ...name State type string cfproperty name Country type string cfcomponent This component represnts a complex data type that can be used in a component that is exported as a web service such as the follow...

Страница 282: ...er date cachedWithin timespan Either of the following debug Yes or No or debug SQL statement s cfquery See also cfinsert cfprocparam cfprocresult cfqueryparam cfstoredproc cftransaction cfupdate chapt...

Страница 283: ...ms timeout Maximum number of seconds that each action of a query is permitted to execute before returning an error The cumulative time may exceed this value For JDBC statements ColdFusion sets this at...

Страница 284: ...ecommends that you use the DateFormat and TimeFormat functions to format values from queries For more information and examples see TechNote 22183 ColdFusion Server 5 and 4 5 x with Oracle Formatting D...

Страница 285: ...font size 1 ParkName font td td valign top font size 1 Region font td td valign top font size 1 State font td tr cfoutput If the total number of records is less than or equal to the total number of r...

Страница 286: ...r databases from unauthorized users For more information see Security Bulletin ASB99 04 Multiple SQL Statements in Dynamic Queries at www macromedia com devnet security security_zone asb99 04 html Cha...

Страница 287: ..._SQL_DECIMAL CF_SQL_DOUBLE CF_SQL_FLOAT CF_SQL_IDSTAMP CF_SQL_INTEGER CF_SQL_LONGVARCHAR CF_SQL_MONEY CF_SQL_MONEY4 CF_SQL_NUMERIC CF_SQL_REAL CF_SQL_REFCURSOR CF_SQL_SMALLINT CF_SQL_TIME CF_SQL_TIMES...

Страница 288: ...OAT CF_SQL_DOUBLE CF_SQL_TINYINT CF_SQL_MONEY CF_SQL_MONEY4 CF_SQL_DECIMAL CF_SQL_NUMERIC and CF_SQL_BIGINT For these types a data value can be converted to a date supported by the target data source...

Страница 289: ...tFirst datasource cfsnippets SELECT FROM employees WHERE LastName cfqueryparam value LastName cfsqltype CF_SQL_VARCHAR maxlength 17 cfquery cfoutput query getFirst p Course Number FirstName LastName D...

Страница 290: ...her tags Variable manipulation tags Syntax The tag syntax depends on the action attribute value See the following sections cfregistry action getAll on page 291 cfregistry action get on page 292 cfregi...

Страница 291: ...try action getAll branch HKEY_LOCAL_MACHINE Software Microsoft Java VM type Any name RegQuery p h1 cfregistry action getAll h1 cftable query RegQuery colHeaders HTMLTable border Yes cfcol header b Ent...

Страница 292: ...s cfregistry with the Get Action cfregistry action get branch HKEY_LOCAL_MACHINE Software Microsoft Java VM entry ClassPath type String variable RegValue h1 cfregistry action get h1 cfoutput p Java Cl...

Страница 293: ...tead of setting one here cfset FileName dummy cfm cfregistry action set branch HKEY_LOCAL_MACHINE Software cflangref entry LastCFM01 type String value FileName h1 cfregistry action set h1 Attribute Re...

Страница 294: ...ined beneath it Example cfregistry action delete branch HKEY_LOCAL_MACHINE Software cflangref tempkey entry LastCFM01 h1 cfregistry action delete h1 Attribute Req Opt Default Description action Requir...

Страница 295: ...e The connection is not subject to any ColdFusion data source specific restrictions For example the Crystal Reports server can access a data source regardless of whether it is disabled in the ColdFusi...

Страница 296: ...ly the information for a subset of the report cfreport report reports monthlysales rpt Departments Department International cfreport p Substitute your report files and filters for this code cfreport c...

Страница 297: ...the handler raises the exceptions again with details intact so that a higher level handler can process the error information If you used the cfthrow tag the type and details of the original exception...

Страница 298: ...pulate a structure with name value pairs and return the structure with this tag To access the result value from this tag you use the variable scope that is the value of the cfinvoke tag returnVariable...

Страница 299: ...cfreturn 299 cffunction cfcomponent...

Страница 300: ...age This tag requires an end tag You cannot use this tag to suppress output from a tag library Example The following example uses a custom tag to generate a report and saves the report in the variable...

Страница 301: ...e path path_to_file startDate date startTime time url URL port port_number publish Yes or No endDate date endTime time interval seconds requestTimeOut seconds username username password password proxy...

Страница 302: ...Required if action update URL of the page to execute port Optional 80 Port to use on the server that is specified by the url parameter If resolveURL yes retrieved document URLs that specify a port nu...

Страница 303: ...on the specified day of each month for 30 or 31 day months and the last day of February For example if you schedule a monthly job to start on January 30 the job will run on January 30 February 28 or...

Страница 304: ...This tag uses ColdFusion functions expressions and operators You can read and write ColdFusion variables within this tag For a detailed description of the CFScript scripting language including documen...

Страница 305: ...Object component nasdaq quote invocation using ordered arguments res quote getLastTradePrice macr cfscript The following example shows how to use an attribute collection within the cfscript tag to pas...

Страница 306: ...Using Web Services in Developing ColdFusion MX Applications Example p This simple example shows variable declaration and manipulation cfif IsDefined form myValue cfif IsNumeric form myValue cfset x f...

Страница 307: ...ndexed in the following ways In ColdFusion with the cfindex tag In the ColdFusion Administrator which calls the cfindex tag Using a native Verity indexing tool such as Vspider or MKVDK For more inform...

Страница 308: ...s and or registered collection name s For a registered collection specify the collection name For an unregistered collection specify an absolute path Registered names are listed in the ColdFusion Adm...

Страница 309: ...ar mySearch 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 Developing ColdFusion MX App...

Страница 310: ...custom1 br custom2 name custom2 br summary name summary br recordcount name recordcount br currentrow name currentrow br columnlist name columnlist br recordssearched name recordssearched br cfoutput...

Страница 311: ...br title book titleE br score book score br custom1 book custom1 br custom2 book custom2 br summary book summary br recordcount book recordcount br currentrow book currentrow br columnlist book column...

Страница 312: ...display at one time The default 1 displays a drop down list Any other value displays a list box with size number of entries visible at one time required Optional No Yes a list element must be selecte...

Страница 313: ...add other HTML input tag attributes and values to this tag use the passThrough attribute They are passed through to the select tag that ColdFusion generates for the cfselect control when creating a fo...

Страница 314: ...sentation of Data h3 h4 Click on an employee s last name and hit see information for this employee to see expanded information h4 cfselect name EmployeeNames message Select an Employee Name size getEm...

Страница 315: ...ld No bgcolor Teal selectmode BROWSE picturebar No cfgridcolumn name LastName header Last Name headeralign LEFT dataalign LEFT bold No italic No select Yes display Yes headerbold No headeritalic No cf...

Страница 316: ...server as ColdFusion use code such as the following in which path specifies a servlet JSP or anything else GetPageContext include path GetPageContext forward path For more information see the JSP Pag...

Страница 317: ...to the servlet 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 GetPageCon...

Страница 318: ...the following line is a valid ColdFusion cfset tag for deleting the MyVariable variable from the Application scope cfset StructDelete Application MyVariable Arrays The following example assigns a new...

Страница 319: ...riable myVar exists only when the function myFunct executes and it is not available elsewhere on the ColdFusion page COM objects In this example a COM object is created A cfset defines a value for eac...

Страница 320: ...passed from another page h3 cfif p cfset can also be used to collect environmental variables such as the time the IP address of the user or another function or expression cfset the_date DateFormat Now...

Страница 321: ...d by the first cfcatch block that could handle an exception of its type Attributes Usage The cfsetting requestTimeout attribute replaces the use of requestTmeOut within a URL To enforce a page timeout...

Страница 322: ...tput Yes the IsDebugMode function returns Yes otherwise No ColdFusion MX 6 1 allows a cfsetting end tag however this end tag does not effect processing The cfsetting attributes affect code inside and...

Страница 323: ...nt cfsilent See also cfcache cfflush cfheader cfhtmlhead cfinclude cfsetting Usage This tag requires an end tag Example h3 cfsilent h3 cfsilent cfset a 100 cfset b 99 cfset c b a cfoutput Inside cfsil...

Страница 324: ...o tickMarkMinor Yes or No tickMarkImages URL1 URL2 URLn tickMarkLabels Yes or No or list lookAndFeel motif or windows or metal vertical Yes or No bgColor color textColor color font font_name fontSize...

Страница 325: ...e if validation fails Specify only the function name height Optional 40 Slider control height in pixels width Optional Slider control width in pixels vSpace Optional Vertical spacing above and below s...

Страница 326: ...n does not automatically swap width and height values No renders slider horizontally bgColor Optional Background color of slider label For a hex value use the form bgColor xxxxxx where x 0 9 or A F us...

Страница 327: ...responding controls on the user entry form For more information see the cfform tag entry Example This example shows how to use cfslider within cfform h3 cfslider Example h3 p cfslider used within a cf...

Страница 328: ...on MX uses Type 4 JDBC drivers Attributes 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 proced...

Страница 329: ...Example This view only example executes a Sybase stored procedure that returns three result sets two of which we want The stored procedure returns the status code and one output parameter which we dis...

Страница 330: ...code within this tag must be within a cfcase or cfdefaultcase tag Otherwise ColdFusion throws an error Use this tag followed by one or more cfcase tags Optionally include a cfdefaultcase tag This tag...

Страница 331: ...ase is output p cfoutput query GetEmployees cfswitch expression Trim Department cfcase value Sales FirstName LastName is in b sales b br br cfcase cfcase value Accounting FirstName LastName is in b ac...

Страница 332: ...ws_table colSpacing number_of_spaces headerLines number_of_lines HTMLTable border colHeaders startRow row_number cftable See also cfcol cfoutput cfcontent cfprocessingdirective cflog cftable Attribute...

Страница 333: ...me LastName EMail Phone Department FROM Employees cfquery html body h3 cftable Example h3 Note use of HTMLTable attribute to display cftable as an HTML table rather than as PRE formatted information c...

Страница 334: ...eger vSpace integer hSpace integer align alignment bgColor color textColor color maxLength integer notSupported text See also cfapplet cfform cfgrid cfgridcolumn cfgridrow cfgridupdate cfinput cfselec...

Страница 335: ...object and input object value are passed to routine which should return True if validation succeeds False otherwise The validate attribute is ignored pattern Required if validate regular_ expression J...

Страница 336: ...ne texttop absbottom middle absmiddle right bgColor Optional Background color of control For a hex value use the form textColor xxxxxx where x 0 9 or A F use two pound signs or none any color in hex f...

Страница 337: ...ut control is used Example h3 cftextinput Example h3 cftextinput provides simple validation for text fields in cfform and control over font information displayed in cfform input boxes for text For exa...

Страница 338: ...his tag can throw ColdFusion component method exceptions Attributes Attribute Req Opt Default Description type Optional Application A custom type Application Do not enter another predefined type types...

Страница 339: ...lass has constructors that take parameters such as a message you can use the special init method to invoke the constructor as in the following line If you do not need to specify any constructor attrib...

Страница 340: ...red yes cfquery name empQuery datasource ExampleApps SELECT LASTNAME FIRSTNAME EMAIL FROM tblEmployees WHERE LASTNAME LIKE arguments lastName cfquery cfif empQuery recordcount LT 1 cfthrow type noQuer...

Страница 341: ...section Category Debugging tags Variable manipulation tags Syntax cftrace abort Yes or No category string inline Yes or No text string type format var variable_name cftrace See also cfdump cferror cf...

Страница 342: ...2 23 58 58 5187 ms 10 C cfusion wwwroot generic cfm line 14 category thisPage generic cfm ABORTED thisPage For a complex variable ColdFusion lists the variable name and the number of elements in the o...

Страница 343: ...end tag Within a transaction block you can write queries to more than one database but you must commit or rollback a transaction to one database before writing a query to another Using CFML error hand...

Страница 344: ...RT INTO Courses Number Descript VALUES myNumber myDescription cfquery cfquery name insertNewCourseToList datasource Snippets INSERT INTO CourseList CorNumber CorDesc Dept_ID CorName CorLevel LastUpdat...

Страница 345: ...r No bold Yes or No height integer width integer vSpace integer hSpace integer align alignment border Yes or No hScroll Yes or No vScroll Yes or No notSupported text cftree See also cfapplet cfform cf...

Страница 346: ...tional JavaScript function to validate user input The form object input object and input object value are passed to the specified routine which should return True if validation succeeds False otherwis...

Страница 347: ...ery takes a list of employees and uses cftree and cfselect to display the results cfgrid is used to show an alternate means of displaying the same data set a default for the employeeNames variable cfp...

Страница 348: ...ta Loop through the query to create each branch of the cftree h3 cftree Presentation of Data h3 h4 Click on the folders to drill down and reveal information h4 p cftreeitem is used to create the branc...

Страница 349: ...rm is submitted When populating a tree with data from a cfquery specify columns in a delimited list Example value dept_id emp_id display Optional value Tree item label When populating a tree with data...

Страница 350: ...employeeNames cfif cfquery Use cfform when using other cfinput tools cfform action cfindex cfm imgopen Optional Icon displayed with open tree item You can specify icon filename with a relative path Yo...

Страница 351: ...No cftreeitem value Department display Department parent Emp_ID queryAsRoot No expand No cftreeitem value Department parent Department expand No queryAsRoot No cftreeitem value Phone display Phone par...

Страница 352: ...lay Yes headerbold No headeritalic No cfgridcolumn name Department header Department headeralign LEFT dataalign LEFT bold Yes italic No select No display Yes headerbold No headeritalic No cfgridcolumn...

Страница 353: ...y block put the code that might throw an exception followed by one ore more cfcatch tags that catch and process exceptions This tag requires an end tag Example cftry example using TagContext to displa...

Страница 354: ...354 Chapter 2 ColdFusion Tags cfoutput cfcatch cftry...

Страница 355: ...ble to update For ORACLE drivers must be uppercase For Sybase driver case sensitive must be in same case as used when the table was created tableOwner Optional For data sources that support table owne...

Страница 356: ...TE Example title cfset css_path css cfinclude template resource include mm_browsersniff cfm head body H3 CFUPDATE Example H3 If we are updating a record don t show the entire list cfif IsDefined url C...

Страница 357: ...cfupdate 357 cftable cfif body html...

Страница 358: ...fdump cfexecute cfindex cfobject cfreport cfsearch History ColdFusion MX Changed column name case behavior ColdFusion preserves the case of column names in JavaScript Earlier releases converted query...

Страница 359: ...ge_Id Thread_id Username from messages cfquery The recordset data is p cfoutput query q Message_ID Thread_ID Username br cfoutput p Serialize data to WDDX format Serializing CFML data p cfwddx action...

Страница 360: ...sion Tags Deserialize to a variable named wddxResult Deserializing WDDX packet p cfwddx action wddx2cfml input wddxText output qnew The recordset data is p cfoutput query qnew Message_ID Thread_ID Use...

Страница 361: ...s text that displays the value of the ColdFusion variable testVar The code creates four nested child elements which are generated by an indexed cfloop tag The cfdump tag displays the XML document obje...

Страница 362: ...362 Chapter 2 ColdFusion Tags cfloop MyDoc cfxml cfdump var MyDoc...

Страница 363: ...oldFusion Functions This chapter lists and categorizes ColdFusion Markup Language CFML functions Contents Function list 364 Functions by category 367 Function changes since ColdFusion 5 372 Function d...

Страница 364: ...ctions ParameterExists ArrayLen GetProfileString ParseDateTime ArrayMax GetTempDirectory Pi ArrayMin GetTempFile PreserveSingleQuotes ArrayNew GetTemplatePath Quarter ArrayPrepend GetTickCount QueryAd...

Страница 365: ...eateTimeSpan IsXmlElem Sqr CreateUUID IsXmlRoot StripCR DateAdd JavaCast StructAppend DateCompare JSStringFormat StructClear DateConvert LCase StructCopy DateDiff Left StructCount DateFormat Len Struc...

Страница 366: ...Month LSCurrencyFormat ValueList Fix LSDateFormat Week FormatBaseN LSEuroCurrencyFormat Wrap GetAuthUser LSIsCurrency WriteOutput GetBaseTagData LSIsDate XmlChildPos GetBaseTagList LSIsNumeric XmlElem...

Страница 367: ...s 369 International functions 369 List functions 369 Mathematical functions 370 Other functions 370 Query functions 370 String functions 370 Structure functions 371 System functions 371 XML functions...

Страница 368: ...rt GetHttpTimeString Minute DateDiff GetTickCount Month DirectoryExists IsDebugMode IsObject IsXmlRoot FileExists IsDefined IsQuery LSIsCurrency IIf IsK2ServerABroker IsSimpleValue LSIsDate IsArray Is...

Страница 369: ...tExceeded DateConvert LSIsCurrency LSParseDateTime LSParseNumber GetEncoding LSCurrencyFormat LSIsNumeric LSTimeFormat GetHttpTimeString LSDateFormat LSNumberFormat SetEncoding GetLocale LSEuroCurren...

Страница 370: ...ring Abs BitNot FormatBaseN Randomize ACos BitOr IncrementValue RandRange ArrayAvg BitSHLN InputBaseN Round ArraySum BitSHRN Int Sgn ASin BitXor Log Sin Atn Ceiling Log10 Sqr BitAnd Cos Max Tan BitMas...

Страница 371: ...h LSParseNumber Right Insert LTrim RJustify JavaCast Mid RTrim Duplicate StructCount StructGet StructKeyList IsStruct StructDelete StructInsert StructNew StructAppend StructFind StructIsEmpty StructSo...

Страница 372: ...ColdFusion MX 6 1 GetAuthUser All ColdFusion MX GetEncoding All ColdFusion MX GetMetaData All ColdFusion MX GetPageContext All ColdFusion MX GetProfileSections All ColdFusion MX IsObject All ColdFusi...

Страница 373: ...ue Deprecated as of this ColdFusion release getMetricData cachepops parameter ColdFusion MX getK2ServerDocCount All ColdFusion MX 6 1 getK2ServerDocCount Limit All ColdFusion MX 6 1 getTemplatePath Al...

Страница 374: ...absolute value of a number Category Mathematical functions Function syntax Abs number See also Sgn Parameters Example h3 Abs Example h3 p The absolute value of the following numbers 1 3 4 3 2 6 is cfo...

Страница 375: ...t its arccosine value cfif IsDefined FORM CosNum cfif IsNumeric FORM CosNum cfif Abs FORM CosNum LESS THAN OR EQUAL TO 1 cfoutput ACos FORM CosNum ACos FORM cosNum Radians cfoutput br or br cfoutput A...

Страница 376: ...ets SELECT FirstName LastName FROM Employees cfquery create an array cfset myArray ArrayNew 1 set element one to show where we are cfset myArray 1 Test Value loop through the query append these names...

Страница 377: ...be dynamically generated on the screen It uses the Fieldnames variable with the ListLen function to determine the number of fields on the form cfset FormElem 2 cfif Isdefined Form Submit cfif Form Sub...

Страница 378: ...IsDefined FORM submit cfset myNumberArray ArrayNew 1 cfset Count 1 cfloop index ListItem list Form Fieldnames cfif Left ListItem 3 is Num cfset myNumberArray Count Val Evaluate number Count cfset coun...

Страница 379: ...create a new array cfset MyArray ArrayNew 1 populate an element or two cfset MyArray 1 Test cfset MyArray 2 Other Test output the contents of the array p Your array contents are cfoutput ArrayToList...

Страница 380: ...L objects Changed thrown exceptions this function can throw the InvalidArrayIndexException error Parameters Throws If this function attempts to delete an element at position 0 or specifies a value for...

Страница 381: ...to insert an element at position 0 or specifies a value for position that is greater than the size of array this function throws an InvalidArrayIndexException error Example h3 ArrayInsertAt Example h...

Страница 382: ...le h3 ArrayIsEmpty Example h3 create a new array cfset MyArray ArrayNew 1 populate an element or two cfset MyArray 1 Test cfset MyArray 2 Other Test output the contents of the array p Your array conte...

Страница 383: ...ets SELECT FirstName LastName FROM Employees cfquery create an array cfset myArray ArrayNew 1 set element one to show where we are cfset myArray 1 Test Value loop through the query and append these na...

Страница 384: ...o elements in the array cfif IsDefined FORM submit cfset myNumberArray ArrayNew 1 cfset myNumberArray 1 number1 cfset myNumberArray 2 number2 cfif Form Submit is Maximum Value use ArrayMax to find the...

Страница 385: ...s cfif IsDefined FORM submit cfset myNumberArray ArrayNew 1 cfset myNumberArray 1 FORM number1 cfset myNumberArray 2 FORM number2 cfif Form Submit is Minimum Value use ArrayMin to find the smallest nu...

Страница 386: ...yToList does not function properly if the Array is not initialized with ArraySet cfset temp ArraySet MyNewArray 1 6 set some elements cfset MyNewArray 1 Sample Value cfset MyNewArray 3 43 cfset MyNewA...

Страница 387: ...ayNew 1 set element one to show where we are cfset myArray 1 Test Value loop through query Append names successively before last element list reverses itself from the standard queried output as it kee...

Страница 388: ...on Category Array functions Function syntax ArrayResize array minimum_size Parameters Example h3 ArrayResize Example h3 perform a query to get the list cfquery name GetCourses datasource cfsnippets SE...

Страница 389: ...eters Example h3 ArraySet Example h3 Make an array cfset MyNewArray ArrayNew 1 ArrayToList does not function properly if the Array has not been initialized with ArraySet cfset temp ArraySet MyNewArray...

Страница 390: ...l order For example in a textnocase desc sort of d a a b A the following occurs ColdFusion MX returns d b A a a Earlier ColdFusion releases return d b a a A Parameters Parameter Description array Name...

Страница 391: ...t cfquery name GetEmployeeNames datasource cfsnippets SELECT FirstName LastName FROM Employees cfquery create an array cfset myArray ArrayNew 1 loop through the query and append these names successive...

Страница 392: ...ields to the first two elements in the array cfif IsDefined FORM submit cfset myNumberArray ArrayNew 1 cfset myNumberArray 1 number1 cfset myNumberArray 2 number2 cfif Form Submit is Add use ArraySum...

Страница 393: ...tions Function syntax ArraySwap array position1 position2 Parameters Example h3 ArraySwap Example h3 cfset month ArrayNew 1 cfset month 1 February cfset month 2 January cfset temp ArraySwap month 1 2...

Страница 394: ...st element cfloop query GetEmployeeNames cfset temp ArrayAppend myArray FirstName LastName cfloop show the resulting array as a list cfset myList ArrayToList myArray sort that array descending alphabe...

Страница 395: ...value of 65536 Earlier releases supported 1 255 Parameters Example h3 Asc Example h3 if the character string is not empty output its ASCII value cfif IsDefined FORM charVals cfif FORM charVals is not...

Страница 396: ...tput cfoutput Evaluate ASin FORM sinNum Radians cfoutput br or br ASin cfoutput FORM SinNum cfoutput cfoutput Evaluate ASin FORM sinNum 180 Pi Degrees cfoutput cfelse if it is less than negative one o...

Страница 397: ...ASin 397 br input type Text name sinNum size 25 p input type Submit name input type RESET form...

Страница 398: ...180 To convert radians to degrees multiply radians by 180 Example h3 Atn Example h3 output its Atn value cfif IsDefined FORM AtnNum cfif IsNumeric FORM AtnNum Atn cfoutput FORM AtnNum cfoutput cfoutp...

Страница 399: ...is obsolete Use the newer security tools see Authentication functions on page 367 and Chapter 16 Securing Applications in Developing ColdFusion MX Applications History ColdFusion MX This function is o...

Страница 400: ...ion is obsolete Use the newer security tools see Authentication functions on page 367 and Chapter 16 Securing Applications in Developing ColdFusion MX Applications History ColdFusion MX This function...

Страница 401: ...Or BitXor Parameters Usage Bit functions operate on 32 bit signed integers in the range 2147483648 2147483647 Example h3 BitAnd Example h3 p Returns the bitwise AND of two long integers p BitAnd 5 255...

Страница 402: ...n 32 bit signed integers in the range 2147483648 2147483647 Example h3 BitMaskClear Example h3 p Returns number bitwise cleared with length bits beginning from start p BitMaskClear 255 4 4 cfoutput Bi...

Страница 403: ...egers in the range 2147483648 2147483647 Example h3 BitMaskRead Example h3 p Returns integer created from em length em bits of em number em beginning with em start em p BitMaskRead 255 4 4 cfoutput Bi...

Страница 404: ...d integers in the range 2147483648 2147483647 Example h3 BitMaskSet Example h3 p Returns number bitwise masked with length bits of mask beginning at start p BitMaskSet 255 255 4 4 cfoutput BitMaskSet...

Страница 405: ...tion syntax BitNot number See also BitAnd BitOr BitXor Parameters Usage Bit functions operate on 32 bit signed integers in the range 2147483648 2147483647 Example h3 BitNot Example h3 p Returns the bi...

Страница 406: ...r2 See also BitAnd BitNot BitXor Parameters Usage Bit functions operate on 32 bit signed integers in the range 2147483648 2147483647 Example h3 BitOr Example h3 p Returns the bitwise OR of two long in...

Страница 407: ...e on 32 bit signed integers in the range 2147483648 2147483647 Example h3 BitSHLN Example h3 p Returns the number bitwise shifted without rotation to the left by count bits p BitSHLN 1 1 cfoutput BitS...

Страница 408: ...Usage Bit functions operate on 32 bit signed integers in the range 2147483648 2147483647 Example h3 BitSHRN Example h3 p Returns a number bitwise shifted without rotation to the right by count bits p...

Страница 409: ...t BitOr Parameters Usage Bit functions operate on 32 bit signed integers in the range 2147483648 2147483647 Example h3 BitXOr Example h3 p Returns the bitwise XOR of two long integers p BitXOr 5 255 c...

Страница 410: ...is greater than a given number Category Mathematical functions Function syntax Ceiling number See also Int Fix Round Parameters Example h3 Ceiling Example h3 cfoutput p The ceiling of 3 4 is ceiling 3...

Страница 411: ...e two character string Chr 13 Chr 10 returns a Windows newline Note For a complete list of the Unicode characters and their codes see www unicode org charts Example If the character string is not empt...

Страница 412: ...tring Cjustify FORM justifyString 35 cfif html head title CJustify Example title head body h3 CJustify h3 p Enter a string it will be center justified within the sample field form action cjustify cfm...

Страница 413: ...parison of two strings cfif IsDefined FORM string1 cfset comparison Compare FORM string1 FORM string2 switch on the variable to give various responses cfswitch expression comparison cfcase value 1 h3...

Страница 414: ...414 Chapter 3 ColdFusion Functions p String 1 br input type Text name string1 p String 2 br input type Text name string2 p input type Submit value Compare these Strings name input type RESET form...

Страница 415: ...CFSET comparison Comparenocase form string1 form string2 switch on the variable to give various responses CFSWITCH EXPRESSION comparison CFCASE value 1 H3 String 1 is less than String 2 H3 I The strin...

Страница 416: ...416 Chapter 3 ColdFusion Functions P INPUT TYPE Submit VALUE Compare these Strings NAME INPUT TYPE RESET FORM...

Страница 417: ...0000000001 Example h3 Cos Example h3 Calculate cosine if form has been submitted cfif IsDefined FORM cosNum Make sure input is a number cfif IsNumeric FORM cosNum Convert degrees to radians call the C...

Страница 418: ...418 Chapter 3 ColdFusion Functions br br input type Submit name nbsp nbsp input type RESET form...

Страница 419: ...2 13 0 li Formatted with CreateODBCDate CreateODBCDate yourDate li Formatted with CreateODBCDateTime CreateODBCDateTime yourDate ul p The same value can be formatted with DateFormat ul li Formatted wi...

Страница 420: ...METHOD POST p Enter the year month and day as integers PRE Year CFINPUT TYPE Text NAME year VALUE 1998 VALIDATE integer REQUIRED Yes Month CFINPUT TYPE Text NAME month VALUE 6 VALIDATE integer REQUIRE...

Страница 421: ...our form minute form second li Formatted with CreateODBCDate CreateODBCDate yourDate li Formatted with CreateODBCDateTime CreateODBCDateTime yourDate ul p The same value can be formatted with DateForm...

Страница 422: ...Text NAME month VALUE 6 RANGE 1 12 MESSAGE Please enter a month 1 12 VALIDATE integer REQUIRED Yes Day CFINPUT TYPE Text NAME day VALUE 8 RANGE 1 31 MESSAGE Please enter a day of the month 1 31 VALID...

Страница 423: ...Applications For CORBA object changed the Naming Service separator format for addresses from a dot to a forward slash For example if context NameService for a class use either of the following format...

Страница 424: ...class context serverName See also ReleaseComObject cfobject Parameters Usage The following example creates the Windows Collaborative Data Objects CDO for NTS NewMail object to send mail You would use...

Страница 425: ...to the tellTime component using the CreateObject function The CreateObject function references the component in another directory To invoke component methods you use function syntax For more informat...

Страница 426: ...context in the naming service You must provide the object s attributes method names and method signatures This function supports user defined types structures arrays and sequences Example myobj Create...

Страница 427: ...CreateObject 427 myobj CreateObject corba Macromedia Eng CF nameservice visibroker uses nameservice myobj CreateObject corba d temp tester ior nameservice uses nameservice and default configuration...

Страница 428: ...init method with appropriate arguments to call an instance of the class For example cfset ret myObj init arg1 arg2 Calling a public method on the object without first calling the init method invokes...

Страница 429: ...rvice object Function syntax CreateObject type urltowsdl Parameters Usage You can use the CreateObject function to create a web service Example newobject2 CreateObject webservice wsdlurl Parameter Des...

Страница 430: ...ue generated with CreateDateTime cfset yourDate CreateDateTime form year form month form day form hour form minute form second cfoutput ul li Formatted with CreateDate CreateDate form year form month...

Страница 431: ...t name day value 8 range 1 31 MESSAGE Please enter a day of the month 1 31 VALIDATE integer REQUIRED Yes Hour cfinput type text name hour value 16 range 0 23 MESSAGE You must enter an hour 0 23 VALIDA...

Страница 432: ...hour form minute form second cfoutput ul li Formatted with CreateDate CreateDate form year form month form day li Formatted with CreateDateTime CreateDateTime form year form month form day form hour...

Страница 433: ...me day value 8 range 1 31 MESSAGE Enter a day of the month 1 31 VALIDATE integer REQUIRED Yes Hour cfinput type text name hour value 16 range 0 23 MESSAGE You must enter an hour 0 23 VALIDATE integer...

Страница 434: ...CreateTime form hour form minute form second cfoutput ul li Formatted with CreateODBCTime CreateODBCTime yourTime li Formatted with TimeFormat TimeFormat yourTime ul cfoutput cfif cfform action creat...

Страница 435: ...cond cfoutput ul li Formatted with timeFormat TimeFormat yourTime li Formatted with timeFormat and hh mm ss TimeFormat yourTime hh mm ss ul cfoutput cfif CFFORM action createtime cfm METHOD post PRE H...

Страница 436: ...TimeSpan function is used to define a period of time from the present backwards The cachedWithin attribute takes effect only if you enable query caching in the ColdFusion Administrator For more inform...

Страница 437: ...axrows maxrows TR TD valign top bgcolor ffffed b GetParks CurrentRow b TD TD valign top font size 1 ParkName font TD TD valign top font size 1 Region font TD TD valign top font size 1 State font TD TR...

Страница 438: ...a user defined function called CreateGUID which converts CFML UUIDs to UUID Microsoft GUID format available on the web at www cflib org Use this function to generate a persistent identifier in a dist...

Страница 439: ...g you must enclose it in quotation marks Otherwise it is interpreted as a numeric representation of a date time object Example This example shows the use of DateAdd cfparam name value default 70 cfpar...

Страница 440: ...hours cfcase cfcase value n minutes cfcase cfcase value s seconds cfcase cfdefaultcase years cfdefaultcase cfswitch are expired table tr td UserName td td Subject td td Posted td tr cfoutput query Get...

Страница 441: ...ues cfif IsDefined FORM date1 cfif IsDate FORM date1 and IsDate FORM date2 cfset comparison DateCompare FORM date1 FORM date2 FORM precision switch on the variable to give various responses cfswitch e...

Страница 442: ...h3 This is the default case h3 cfdefaultcase cfswitch cfelse h3 Enter two valid date values h3 cfif cfif form action datecompare cfm hr size 2 color 0000A0 p Date 1 br input type Text name date1 valu...

Страница 443: ...ample h3 This shows conversion of current date time to UTC and back cfset curDate Now p cfoutput The current date and time curDate cfoutput p cfset utcDate DateConvert local2utc curDate cfoutput p The...

Страница 444: ...6 range 1 12 message Enter a month 1 12 validate integer required Yes td tr tr td Day td td input type Text name day value 8 range 1 31 message Enter a day of the month 1 31 validate integer required...

Страница 445: ...Usage The DateDiff function determines the number of complete datepart units between the two dates for example if the datepart parameter is m and the dates differ by 55 days the function returns 1 Enc...

Страница 446: ...seconds cfcase cfdefaultcase years cfdefaultcase cfswitch dateparts between date1 and date2 cfif DateCompare form date1 form date2 is not 0 p The difference is cfoutput Abs DateDiff type form date2 f...

Страница 447: ...What kind of unit to show difference select name type option value yyyy selected years option value q quarters option value m months option value y days of year option value d days option value w wee...

Страница 448: ...f this function for example DateFormat CreateDate 2001 3 3 Parameter Description date Date time object in the range 100 AD 9999 AD mask Characters that show how ColdFusion displays a date d Day of the...

Страница 449: ...th Oracle Formatting Date and Time Query Results on our website at www coldfusion com Support KnowledgeBase SearchForm cfm Example cfset todayDate Now body h3 DateFormat Example h3 p Today s date is c...

Страница 450: ...interpreted as a numeric representation of a date time object Example This example shows information available from DatePart cfset todayDate Now h3 DatePart Example h3 p Today s date is cfoutput toda...

Страница 451: ...ePart 451 li day DatePart d todayDate li weekday DatePart w todayDate li week DatePart ww todayDate li hour DatePart h todayDate li minute DatePart n todayDate li second DatePart s todayDate ul cfoutp...

Страница 452: ...Now function as the date parameter of this function for example Day CreateDate 2001 3 3 Example h3 Day Example h3 cfif IsDefined FORM year p More information about your date cfset yourDate CreateDate...

Страница 453: ...ow function as the date parameter of this function for example DayOfWeek CreateDate 2001 3 3 Example h3 DayOfWeek Example h3 cfif IsDefined FORM year More information about your date cfset yourDate Cr...

Страница 454: ...cfif IsDefined FORM year More information about your date cfset yourDate CreateDate FORM year FORM month FORM day cfoutput p Your date DateFormat yourDate br It is DayofWeekAsString DayOfWeek yourDate...

Страница 455: ...Now function as the date parameter of this function for example DayOfYear CreateDate 2001 3 3 Example h3 Day7OfYear Example h3 cfif IsDefined FORM year More information about your date cfset yourDate...

Страница 456: ...as the date parameter of this function for example DaysInMonth CreateDate 2001 3 3 Example h3 DaysInMonth Example h3 cfif IsDefined FORM year More information about your date cfset yourDate CreateDate...

Страница 457: ...Note You can pass the CreateDate function or the Now function as the date parameter of this function for example DaysInYear CreateDate 2001 3 3 Example h3 DaysInYear Example h3 cfif IsDefined FORM yea...

Страница 458: ...ed Category Dynamic evaluation functions Function syntax DE string See also Evaluate IIf Parameters Usage Consider this example condition true expression false expression IIf 1 eq 2 DE Var1 DE Var2 Co...

Страница 459: ...ry Evaluate the expression cfset myExpression Evaluate FORM myExpression Use DE to output the value of the variable unevaluated cfoutput I The value of the expression Evaluate DE FORM MyExpression is...

Страница 460: ...s separator Category Display and formatting functions Function syntax DecimalFormat number See also DollarFormat NumberFormat Parameters Example h3 DecimalFormat Function h3 p Returns a number to two...

Страница 461: ...yntax DecrementValue number See also IncrementValue Parameters Example h3 DecrementValue Example h3 p Returns the integer part of a number decremented by one p DecrementValue 0 cfoutput DecrementValue...

Страница 462: ...ing cfset key FORM myKey cfset encrypted encrypt string key cfset decrypted decrypt encrypted key cfoutput h4 B The string B h4 string br h4 B The key B h4 key br h4 B Encrypted B h4 encrypted br h4 B...

Страница 463: ...DeleteClientVariable Example h3 p This view only example deletes a client variable called User_ID if it exists in the list of client variables returned by GetClientVariablesList p This example require...

Страница 464: ...ample h3 h3 Enter a directory to check for existence h2 form action directoryexists cfm method post input type text name yourDirectory br input type submit name submit form cfif IsDefined FORM yourDir...

Страница 465: ...t NumberFormat Parameters Example This example shows the use of DollarFormat html head title DollarFormat Example title head body h3 DollarFormat Example h3 cfloop from 8 to 50 index counter cfset ful...

Страница 466: ...structures and queries Note With this function you cannot duplicate a COM CORBA or JAVA object returned from the cfobject tag or the CreateObject function If an array element or structure field is a...

Страница 467: ...of a string Try it by entering a string and a key to see the results cfif IsDefined FORM myString cfset string FORM myString cfset key FORM myKey cfset encrypted encrypt string key cfset decrypted dec...

Страница 468: ...useful for forming one variable from multiple variables For example to reference a column of the query qNames with a variable var using an index value to traverse rows you could use the following cod...

Страница 469: ...mber br FORM number raised to the E power exp FORM number cfif FORM number LTE 0 br You must enter a positive real number to see its natural logarithm cfelse br The natural logarithm of FORM number lo...

Страница 470: ...s function can now accept an absolute or relative path in the relative_path attribute To resolve a path this function uses virtual mappings that are defined in the ColdFusion Administrator This functi...

Страница 471: ...files in this directory use CFDIRECTORY to give the contents of the snippets directory order by name and size CFDIRECTORY DIRECTORY thisDirectory NAME myDirectory SORT name ASC size DESC Output the co...

Страница 472: ...GetTemplatePath Parameters Example h3 FileExists Example h3 cfset thisPath ExpandPath cfset thisDirectory GetDirectoryFromPath thisPath cfoutput The current directory is GetDirectoryFromPath thisPath...

Страница 473: ...ringToSearch The quick brown fox jumped over the lazy dog find the stringToSearch br find the stringToSearch 35 br find no such substring stringToSearch br br findnocase the stringToSearch br findnoca...

Страница 474: ...d Replace Parameters Example cfset stringToSearch The quick brown fox jumped over the lazy dog find the stringToSearch br find the stringToSearch 35 br find no such substring stringToSearch br br find...

Страница 475: ...ingToSearch The quick brown fox jumped over the lazy dog find the stringToSearch br find the stringToSearch 35 br find no such substring stringToSearch br br findnocase the stringToSearch br findnocas...

Страница 476: ...OfMonth date See also Day DayOfWeek DayOfWeekAsString DayOfYear DaysInMonth DaysInYear Parameters Usage When passing a date time value as a string you must enclose it in quotation marks Otherwise it i...

Страница 477: ...ons Function syntax Fix number See also Ceiling Int Round Parameters Example h3 Fix Example h3 p Fix returns the closest integer less than the number if the number is greater than or equal to 0 Fix re...

Страница 478: ...e base specified by Radix p cfoutput br FormatBaseN 10 2 FormatBaseN 10 2 br FormatBaseN 1024 16 FormatBaseN 1024 16 br FormatBaseN 125 10 FormatBaseN 125 10 br FormatBaseN 10 75 2 FormatBaseN 10 75 2...

Страница 479: ...Applications in Developing ColdFusion MX Applications History ColdFusion MX Added this function Usage This function works with cflogin authentication or web server authentication It checks for a logge...

Страница 480: ...cenumber See also GetBaseTagList Parameters Example This example shows the use of GetBaseTagData function Typically used in custom tags cfif trim inCustomTag neq cfoutput Running in the context of a c...

Страница 481: ...se cfdefaultcase cftry cfcatch This function displays the following tags only under the following conditions cfloop if it uses a query attribute cfoutput if at least one of its children is a complex e...

Страница 482: ...eturns The absolute path of the application base page as a string Category Other functions System functions Function syntax GetBaseTemplatePath See also GetCurrentTemplatePath FileExists ExpandPath Ex...

Страница 483: ...GetClientVariablesList Example h3 p This view only example deletes a client variable called User_ID if it exists in the list of client variables returned by GetClientVariablesList p This example requi...

Страница 484: ...eExists ExpandPath Usage If the function call is made from a page included with a cfinclude tag this function returns the page path of an included page Contrast this with the GetBaseTemplatePath funct...

Страница 485: ...eExists ExpandPath yourfile p Your file exists in this directory You entered the correct file name GetFileFromPath thisPath yourfile cfelse p Your file was not found in this directory br Here is a lis...

Страница 486: ...486 Chapter 3 ColdFusion Functions input type Submit NAME form...

Страница 487: ...e current page The default encoding if none has been explicitly set is UTF 8 For more information see www iana org assignments character sets Example This example sends the contents of two fields and...

Страница 488: ...the exception object To get the current exception object you must call GetException on the Java object before other methods are invoked on it Example Create the Java object reference cfobject action c...

Страница 489: ...is not cfset yourFile FORM yourFile cfif FileExists ExpandPath yourfile p Your file exists in this directory You entered the correct file name GetFileFromPath thisPath yourfile cfelse p Your file was...

Страница 490: ...lable in ColdFusion Returns A structure of functions Category System functions Function syntax GetFunctionList Example This example shows the use of GetFunctionList cfset fList GetFunctionList cfoutpu...

Страница 491: ...equestData cfoutput table cellpadding 2 cellspacing 2 tr td b HTTP Request item b td td b Value b td tr cfloop collection x headers item http_item tr td http_item td td StructFind x headers http_item...

Страница 492: ...492 Chapter 3 ColdFusion Functions b http_content x content b cfoutput...

Страница 493: ...ategory Date and time functions International functions Function syntax GetHttpTimeString date_time_object See also GetLocale GetTimeZoneInfo SetLocale Parameters Usage The time in the returned string...

Страница 494: ...ng time Avoid using it in production applications This function uses Verity K2Server Release K2 2 0 Returns The number of collection metadata items stored in Verity collections Category Full text sear...

Страница 495: ...rverDocCount History ColdFusion MX 6 1 Deprecated this function It might not work and it might cause an error in later releases ColdFusion MX Added this function Usage If a search generates a larger n...

Страница 496: ...licitly set ColdFusion now determines whether the default locale of the ColdFusion server computer operating system is among the locale values it supports The default locale is stored in the user envi...

Страница 497: ...d to read and write variables that are present during the life of the component Component metadata contains at least the following keys name the component name path an absolute path to the component e...

Страница 498: ...498 Chapter 3 ColdFusion Functions Property metadata contains at least the following key name the property name Other property attributes are returned as additional keys...

Страница 499: ...an integer value that is computed from the state of the server s internal queues Indicates the overall server load prev_req_time Returns the time in milliseconds that it took the server to process the...

Страница 500: ...ReqTimedOut Number of HTTP requests that timed out while in the staging queue or during processing BytesIn Number of bytes in HTTP requests to ColdFusion MX BytesOut Number of bytes in HTTP responses...

Страница 501: ...methods that can be useful in J2EE integration It includes the include and forward methods that provide the equivalent of the corresponding standard JSP tags You use these methods to call JSP pages an...

Страница 502: ...32 ini Returns An initialization file as a struct whose format is as follows Each initialization file section name is a key in the struct Each list of entries in a section of an initialization file is...

Страница 503: ...lization file Enter the full path of your initialization file and submit the form If the form was submitted it gets the initialization path and timeout value specified in the form cfif Isdefined Form...

Страница 504: ...504 Chapter 3 ColdFusion Functions tr table form...

Страница 505: ...ncluding a trailing slash as a string Category System functions Function syntax GetTempDirectory See also GetTempFile History ColdFusion MX Changed behavior on Windows this function now returns the te...

Страница 506: ...System functions Function syntax GetTempFile dir prefix See also GetTempDirectory Parameters Example h3 GetTempFile Example h3 p The temporary directory for this ColdFusion Server is cfoutput GetTempD...

Страница 507: ...ption 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...

Страница 508: ...egments or other page processing elements The value of the counter has no meaning To generate useful timing values take the difference between the results of two GetTickCount calls Example Setup timin...

Страница 509: ...zone east of UTC such as a zone in Germany utcHourOffset offset in hours of local time from UTC utcMinuteOffset offset in minutes beyond the hours offset For North America this is 0 For countries tha...

Страница 510: ...wn red three 2 This function call requests element number 2 from the string using the delimiter The output is as follows red black tan Example B Consider the following code cfset mystring four chr 32...

Страница 511: ...omitted so the function uses the space character as the string delimiter br cfoutput GetToken mystring 3 is GetToken mystring 3 cfoutput br The output of this code is as follows GetToken mystring 3 i...

Страница 512: ...yourString set delimiter cfif FORM yourDelimiter is not cfset yourDelimiter FORM yourDelimiter cfelse cfset yourDelimiter cfif check whether number of elements in list is greater than or equal to the...

Страница 513: ...exposing the password The developer can check the validity of the password with the following code cfif hash form password is not myQuery passwordHash cflocation url unauthenticated cfm cfif Example...

Страница 514: ...e 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 Example This example shows the use of H...

Страница 515: ...d Mid for example against the expanded string The only difference between this function and HTMLEditFormat is that HTMLEditFormat does not surround the text in an HTML pre tag Example This example sho...

Страница 516: ...xpanded string The only difference between this function and HTMLCodeFormat is that HTMLCodeFormat surrounds the text in an HTML pre tag Example This example shows the effects of HTMLCodeFormat and HT...

Страница 517: ...rameters Usage The IIf function is a shortcut for the following construct cfif condition cfset result Evaluate string_expression1 cfelse cfset result Evaluate string_expression2 cfif The expressions s...

Страница 518: ...ple LocalVar is undefined however if you omit pound signs around LocalVar the code works properly cfoutput IIf IsDefined LocalVar LocalVar DE The variable is not defined cfoutput The output is The var...

Страница 519: ...IIf 519 cfoutput b...

Страница 520: ...syntax IncrementValue number See also DecrementValue Parameters Example h3 IncrementValue Example h3 p Returns the integer part of a number incremented by one p IncrementValue 0 cfoutput IncrementValu...

Страница 521: ...seN 1024 16 FormatBaseN 1024 16 br FormatBaseN 125 10 FormatBaseN 125 10 br FormatBaseN 10 75 2 FormatBaseN 10 75 2 cfoutput h3 InputBaseN Example h3 p InputBaseN returns the number obtained by conver...

Страница 522: ...ition GT Len MyString cfoutput p This string only has Len MyString characters therefore you cannot insert the substring FORM mySubString at position FORM insertPosition cfoutput cfif cfelse cfoutput p...

Страница 523: ...functions Function syntax Int number See also Ceiling Fix Round Parameters Example h3 Int Example h3 p Int returns the closest integer smaller than a number p Int 11 7 cfoutput Int 11 7 cfoutput p In...

Страница 524: ...rlier releases it returns False Changed behavior this function can be used on XML objects Parameters Usage This function evaluates a Java array object such as vector object as having one dimension Exa...

Страница 525: ...solete Use the newer security tools see Authentication functions on page 367 and Chapter 16 Securing Applications in Developing ColdFusion MX Applications History ColdFusion MX This function is obsole...

Страница 526: ...nction is obsolete Use the newer security tools see Authentication functions on page 367 and Chapter 16 Securing Applications in Developing ColdFusion MX Applications History ColdFusion MX This functi...

Страница 527: ...ASCII table b br br cfoutput htmleditformat charData cfoutput br br Create a Base 64 representation of this string cfset data64 toBase64 charData Convert string to binary cfset binaryData toBinary da...

Страница 528: ...h3 IsBoolean Example h3 cfif IsDefined FORM theTestValue cfif IsBoolean FORM theTestValue h3 The expression cfoutput DE FORM theTestValue cfoutput is Boolean h3 cfelse h3 The expression cfoutput DE FO...

Страница 529: ...tions always precede IsCustomFunction with an IsDefined test as shown in the example Example h3 IsCustomFunction Example h3 cfscript function realUDF return 1 cfscript cfset X 1 Example that fails exi...

Страница 530: ...530 Chapter 3 ColdFusion Functions IsCustomFunction myTestCFCobject testFunc myTestCFCobject testFunc is a function CFIF...

Страница 531: ...hecks against U S date formats only For other date support see LSDateFormat A date time object falls in the range 100 AD 9999 AD Example h3 IsDate Example h3 cfif IsDefined FORM theTestValue cfif IsDa...

Страница 532: ...Decision functions Function syntax IsDebugMode See also cfsetting Description If debugging output is enabled in ColdFusion Administrator and has not been overridden by setting the cfsetting tag showDe...

Страница 533: ...ith dot notation for example mystruct key Parameters Usage When working with scopes that ColdFusion exposes as structures the StructKeyExists function can sometimes replace this function The following...

Страница 534: ...534 Chapter 3 ColdFusion Functions input type Submit name form...

Страница 535: ...es Verity K2Server Release K2 2 0 Returns True if K2Broker is in configured with ColdFusion False otherwise Category Decision functions Full text search functions Query functions Function syntax IsK2S...

Страница 536: ...Verity and K2Server Administrator pages This function uses Verity K2Server Release K2 2 0 Returns True if the document count limit is exceeded False otherwise Category Decision functions Full text sea...

Страница 537: ...on uses Verity K2Server Release K2 2 0 Returns True if the K2Server is available to perform a search False otherwise Category Decision functions Full text search functions Query functions Function syn...

Страница 538: ...cfif IsDefined FORM theTestValue cfif IsLeapYear FORM theTestValue h3 The year value cfoutput DE FORM theTestValue cfoutput is a Leap Year h3 cfelse h3 The year value cfoutput DE FORM theTestValue cfo...

Страница 539: ...3 IsNumeric Example h3 cfif IsDefined FORM theTestValue cfif IsNumeric FORM theTestValue h3 The string cfoutput DE FORM theTestValue cfoutput can be converted to a number h3 cfelse h3 The string cfout...

Страница 540: ...s which are real numbers Example h3 IsNumericDate Example h3 cfif IsDefined form theTestValue test if the value represents a number or a pre formatted Date value cfif IsNumeric form theTestValue or Is...

Страница 541: ...ion returns False for query and XML objects Example to use this example create a color cfc component as follows cfcomponent cffunction name myFunction access public returntype string Create a structur...

Страница 542: ...542 Chapter 3 ColdFusion Functions cfif cfif...

Страница 543: ...obsolete Use the newer security tools see Authentication functions on page 367 and Chapter 16 Securing Applications in Developing ColdFusion MX Applications History ColdFusion MX This function is obso...

Страница 544: ...is run the value of GetEmployees is cfoutput GetEmployees cfoutput cfif IsSimpleValue GetEmployees p GetEmployees is currently a simple value cfif make a query on the snippets datasource cfquery name...

Страница 545: ...y is run the value of GetEmployees is cfoutput GetEmployees cfoutput cfif IsSimpleValue GetEmployees p GetEmployees is currently a simple value cfif make a query on the snippets datasource cfquery nam...

Страница 546: ...y StructNew StructClear and StructDelete It is an example of a custom tag used to add employees Employee information is passed through the employee structure the EMPINFO attribute In UNIX you must als...

Страница 547: ...IsStruct 547 cfcase cfswitch...

Страница 548: ...curing Applications in Developing ColdFusion MX Applications History ColdFusion MX Added this function Parameters Usage Role names are case sensitive To check if a user is in multiple roles specify th...

Страница 549: ...error Parameters Usage This function processes a WDDX packet with a validating XML parser which uses the WDDX Document Type Definition DTD To prevent CFWDDX deserialization errors you can use this fu...

Страница 550: ...550 Chapter 3 ColdFusion Functions IsWDDX returns IsWDDX packet br cfoutput...

Страница 551: ...ue if the function argument is an XML document object False otherwise Category Decision functions XML functions Function syntax IsXmlDoc value See also IsXmlElem IsXmlRoot XmlChildPos XmlNew XmlParse...

Страница 552: ...turns True if the function argument is an XML document object element False otherwise Category Decision functions XML functions Function syntax IsXmlElem value See also IsXmlDoc IsXmlRoot XmlChildPos...

Страница 553: ...True if the function argument is the root object of an XML document object False otherwise Category Decision functions XML functions Function syntax IsXmlRoot value See also IsXmlDoc IsXmlElem XmlChil...

Страница 554: ...e data type not because the method can take a variable number of arguments JavaCast cannot be used to cast between complex objects nor to cast to a super class Use this function s result only on calls...

Страница 555: ...sion can treat this as a string or a real number cfset x 33 Perform an explicit cast to an int and call fooMethod br cfset myInt JavaCast int x cfoutput obj fooMethod myInt cfoutput br br Perform an e...

Страница 556: ...you can put arbitrary strings safely into JavaScript Example This example shows the use of the JSStringFormat function h3 JSStringFormat h3 cfset stringValue An example string value with a tab chr 8 a...

Страница 557: ...fined FORM sampleText cfif FORM sampleText is not p Your text cfoutput FORM sampleText cfoutput returned in lowercase is cfoutput LCase FORM sampleText cfoutput cfelse p Please enter some text cfif cf...

Страница 558: ...removeChars cfoutput leftmost characters of this string because it is not long enough cfelse p Your original string cfoutput form myText cfoutput p Your changed string showing only the cfoutput form r...

Страница 559: ...Left 559 option value 9 9 select input type Submit name Remove characters form...

Страница 560: ...en calculating a length some string processing functions processed the ASCII 0 NUL character but did not process subsequent characters of the string Parameters Example h3 Len Example h3 cfif IsDefined...

Страница 561: ...is 0 cfset myList MyValue cfelse cfset myList myList MyValue cfif The following table shows examples of ListAppend processing Example h3 ListAppend Example h3 First query to get some values for our l...

Страница 562: ...nfo datasource cfsnippets SELECT PARKNAME CITY STATE FROM PARKS WHERE PARKNAME LIKE AL cfquery cfset temp ValueList GetParkInfo ParkName cfoutput p The original list temp cfoutput now append a park na...

Страница 563: ...ERE PARKNAME LIKE BA CFQUERY CFSET temp ValueList GetParkInfo ParkName cfoutput p The original list p temp cfoutput Change the delimiters in the list CFSET temp2 ListChangeDelims Temp P cfoutput p Aft...

Страница 564: ...nbsp nbsp Substring wo is in B element ListContains aList wo B of list cfoutput p ListFind cannot check for a substring within an element therefore in the code it does not find substring wo it returns...

Страница 565: ...ListContains 565 cfoutput The string two is in b element ListFind aList two b of the list cfoutput...

Страница 566: ...et some values for our list cfquery name GetParkInfo datasource cfsnippets SELECT PARKNAME CITY STATE FROM Parks WHERE PARKNAME LIKE form letter cfquery cfset tempList ValueList GetParkInfo City cfif...

Страница 567: ...ome values for our list elements CFQUERY NAME GetParkInfo DATASOURCE cfsnippets SELECT PARKNAME CITY STATE FROM Parks WHERE PARKNAME LIKE CHI CFQUERY CFSET temp ValueList GetParkInfo ParkName CFSET de...

Страница 568: ...568 Chapter 3 ColdFusion Functions p The changed list temp2 p I This list element br deleted_element br is no longer present at position three of the list I cfoutput...

Страница 569: ...Leary p Pick a search type select name type option value ListFind selected Case Sensitive option value ListFindNoCase Case Insensitive select input type Submit name value Search Employee List form wai...

Страница 570: ...at ListGetAt ValueList SearchEmpLastName Phone temp p This was the first employee found under this case sensitive last name search cfoutput cfif cfelse cfset temp ListFindNoCase myList form myString c...

Страница 571: ...ch type select name type option value ListFind selected Case Sensitive option value ListFindNoCase Case Insensitive select input type Submit name value Search Employee List form wait to have a string...

Страница 572: ...rchEmpLastName Phone temp p This was the first employee found under this case sensitive last name search cfoutput cfif cfelse cfset temp ListFindNoCase myList form myString cfif temp is 0 h3 An employ...

Страница 573: ...tMessageUser Username p Before editing the list it is nbsp cfoutput ValueList GetMessageUser Username cfoutput p Users who posted more than once are listed more than once Show the first user in the li...

Страница 574: ...e MyValue two hundred not two hundred and spaces within a list element are preserved ColdFusion ignores empty list elements thus the list a b c d has four elements Example h3 ListGetAt Example h3 Find...

Страница 575: ...ListGetAt 575 cfloop From 1 To ListLen temp index Counter cfoutput li Username Counter ListGetAt temp Counter cfoutput cfloop ul...

Страница 576: ...ts Example This example shows ListInsertAt cfquery name GetParkInfo datasource cfsnippets SELECT PARKNAME CITY STATE FROM PARKS WHERE PARKNAME LIKE DE cfquery cfset temp ValueList GetParkInfo ParkName...

Страница 577: ...eserved ColdFusion ignores empty list elements thus the list a b c d has four elements Example h3 ListFirst ListLast and ListRest Example h3 Find a list of users who wrote messages cfquery name GetMes...

Страница 578: ...578 Chapter 3 ColdFusion Functions p Users who posted more than once are listed more than once p The last user in the list is cfoutput ListLast temp cfoutput...

Страница 579: ...essageUser Username loop through the list and show it with ListGetAt h3 This is a list of usernames who have posted messages cfoutput ListLen temp cfoutput users h3 ul cfloop From 1 TO ListLen temp IN...

Страница 580: ...sion returns the contents of the value parameter To add an element to the beginning or end of a list Macromedia recommends that you do so with code such as the following rather than with the ListAppen...

Страница 581: ...ListPrepend 581 cfset first_element ListFirst temp cfoutput p The original list temp cfoutput now insert an element at position 1 cfset temp2 ListPrepend Temp my Inserted Value...

Страница 582: ...es datasource cfsnippets SELECT FirstName LastName FROM Employees cfquery h3 ListQualify Example h3 p This example uses ListQualify to put the full names of the employees in the query within quotation...

Страница 583: ...ach full name cfset qualifiedList1 ListQualify myList CHAR output the array as a list cfoutput p The contents of the qualified list are as follows p p qualifiedList1 p cfoutput show the resulting alph...

Страница 584: ...datasource cfsnippets SELECT Username Subject Posted FROM Messages cfquery cfset temp ValueList GetMessageUser Username p Before editing the list it is nbsp cfoutput ValueList GetMessageUser Username...

Страница 585: ...if delimiters was omitted a comma ColdFusion ignores empty list elements thus the list a b c d has four elements Example h3 ListSetAt Example h3 Find a list of users who wrote messages cfquery name G...

Страница 586: ...temp 2 cfset TempToo ListSetAt temp 2 I changed this subject ul cfloop From 1 To ListLen temptoo INDEX Counter cfoutput li Counter SUBJECT ListGetAt temptoo Counter cfoutput cfloop ul p Note that elem...

Страница 587: ...ation ensures that an ascending and descending sort output elements in exactly reverse order For example in a textnocase desc sort of d a a b A the following occurs ColdFusion MX returns d b A a a Ear...

Страница 588: ...ically since it contains negative and positive numbers and decimal numbers p cfset sortedNums2 ListSort 23 75 34 471 100 9745 Numeric ASC cfoutput sortedNums2 cfoutput p Here is a list to be sorted al...

Страница 589: ...er a comma plus sign Example h3 ListToArray Example h3 Find a list of users who wrote messages cfquery name GetMessageUser datasource cfsnippets SELECT Username Subject Posted FROM Messages cfquery cf...

Страница 590: ...luecount cfm p Select a department p select name departmentName option value Accounting Accounting OPTION option value Administration Administration OPTION option value Engineering Engineering OPTION...

Страница 591: ...epartment ListValueCount myList FORM departmentName cfif numberInDepartment is 0 h3 There are no employees in cfoutput FORM departmentName cfoutput h3 cfelseIf numberInDepartment is 1 cfoutput p There...

Страница 592: ...rm action listvaluecountnocase cfm p Select a department p select name departmentName option value Accounting Accounting OPTION option value Administration Administration OPTION option value Engineeri...

Страница 593: ...rtment cfset numberInDepartment ListValueCountNoCase myList FORM departmentName cfif numberInDepartment is 0 h3 There are no employees in cfoutput FORM departmentName cfoutput h3 cfelseIf numberInDepa...

Страница 594: ...Justify cfparam name jstring default cfif IsDefined FORM justifyString cfset jstring LJustify FORM justifyString 35 cfif html head title LJustify Example title head body h3 LJustify Function h3 p Ente...

Страница 595: ...sitive real number to get its natural logarithm cfelse br The natural logarithm of FORM number log FORM number cfif cfif FORM number LTE 0 br Enter a positive real number to get its logarithm to base...

Страница 596: ...e the natural logarithm of that number cfelse br The natural logarithm of FORM number log FORM number cfif cfif FORM number LTE 0 br You must enter a positive real number to see the logarithm of that...

Страница 597: ...orms Parameters Usage This function uses Java standard locale formatting rules on all platforms Note With a Sun 1 3 1 compliant JVM use the LSEuroCurrencyFormat function to format euro currency values...

Страница 598: ...ustrian 100 000 00 S 100 000 00 EUR100 000 00 ATS100 000 00 100 000 00 German Standard 100 000 00 100 000 00 DM EUR100 000 00 DEM100 000 00 100 000 00 German Swiss SFr 100 000 00 CHF100 000 00 100 000...

Страница 599: ...ormat returns a currency value using the locale convention Default value is local loop through list of locales show currency values for 100 000 units cfloop LIST Server Coldfusion SupportedLocales ind...

Страница 600: ...Parameter Description date A date time object in the range 100 AD 9999 AD mask Characters that show how ColdFusion displays the date d Day of month Digits no leading zero for single digit days dd Day...

Страница 601: ...rmats the date part of a date time value using the locale convention loop through a list of locales show date values for Now cfloop list Server Coldfusion SupportedLocales index locale delimiters cfse...

Страница 602: ...country of the current locale belongs to the Euro Zone whose members have converted to the euro the formatted output for the local type includes the Euro currency sign for the international type the o...

Страница 603: ...an 100 000 00 EUR100 000 00 100 000 00 French Canadian 100 000 00 CAD100 000 00 100 000 00 French Standard 100 000 00 EUR100 000 00 100 000 00 French Swiss SFr 100 000 00 CHF100 000 00 100 000 00 Germ...

Страница 604: ...y value using the locale convention Default value is local Loop through list of locales show currency values for 100 000 units cfloop list Server Coldfusion SupportedLocales index locale delimiters cf...

Страница 605: ...at shows differences between earlier ColdFusion releases and ColdFusion MX in accepting input formats and displaying output see LSCurrencyFormat on page 597 Note If the locale belongs to a Euro zone c...

Страница 606: ...606 Chapter 3 ColdFusion Functions p form action LSIsCurrency cfm p Select a locale for which you would like to check a currency value check the current locale for server cfset serverLocale GetLocale...

Страница 607: ...for example LsIsDate 3 1 2002 in any other locale this function returns False Earlier releases returned True Changed behavior when using the SUN JRE 1 3 1 on an English UK locale this function return...

Страница 608: ...608 Chapter 3 ColdFusion Functions check the current locale for server cfset serverLocale GetLocale...

Страница 609: ...eleases This function uses Java standard locale formatting rules on all platforms Parameters Usage To set the default display format of date time number and currency values use the SetLocale function...

Страница 610: ...ber or threw an error If no mask is specified ColdFusion MX truncates the decimal part as ColdFusion 5 does For example it truncates 1234 567 to 1235 Changed formatting behavior this function might re...

Страница 611: ...ar right and far right The left and right positions are determined by the side of the decimal point on which the code character is shown For formats that do not have a fixed number of decimal places y...

Страница 612: ...99999999999999999999999999 where the last decimal is 10E 14 the rounding factor can cause an incorrect result Example h3 LSNumberFormat Example h3 p LSNumberFormat returns a number value using the loc...

Страница 613: ...equires that the local and international versions of currencies of countries in the Euro zone be formatted using the older country specific designations such as 100 000 00 DM or DEM100 000 00 for the...

Страница 614: ...I B br Local LSCurrencyFormat 123456 78 local br Parsed local Currency LSParseCurrency LSCurrencyFormat 123456 local br International LSCurrencyFormat 123456 78999 international br Parsed Internation...

Страница 615: ...er value time zone information differently than in earlier releases as described in the Usage section Parameters Usage This function can parse any date time or date time combination that conforms to J...

Страница 616: ...t the time value Note This function does not accept POP dates which include a time zone offset value Example h3 LSParseDateTime Example returns a locale specific date time object h3 loop through a lis...

Страница 617: ...to the euro if so the currency string parameter must be formatted in euros on all JVMs including Sun JVM 1 3 1 If the country is not in the Euro zone the string must follow the locale formatting rule...

Страница 618: ...International currency formatting IntlCurrency br Parsed using LSParseEuroCurrency LSParseEuroCurrency IntlCurrency br cfset Currency LSEuroCurrencyFormat 123456 none Value with no currency formattin...

Страница 619: ...umber and currency values use the SetLocale function Example h3 LSParseNumber Example h3 p LSParseNumber converts a locale specific string to a number Returns the number matching the value of string l...

Страница 620: ...620 Chapter 3 ColdFusion Functions cfoutput cfloop...

Страница 621: ...ertible to a time value A date time object is in the range 100 AD 9999 AD mask Masking characters that determine the format h Hours no leading zero for single digit hours 12 hour clock hh Hours leadin...

Страница 622: ...onds value is passed to this function and the mask value is s the default output seconds format is one zero for example lstimeformat 6 39 h m s returns 6 39 0 If the mask value is ss it returns 6 39 0...

Страница 623: ...se64 Parameters Example h3 LTrim Example h3 cfif IsDefined FORM myText cfoutput pre Your string FORM myText Your string LTrim FORM myText left trimmed pre cfoutput cfif form action ltrim cfm p Type in...

Страница 624: ...Num1 and IsNumeric FORM myNum2 p The maximum of the two numbers is cfoutput Max FORM myNum1 FORM myNum2 cfoutput p The minimum of the two numbers is cfoutput Min FORM myNum1 FORM myNum2 cfoutput cfels...

Страница 625: ...utput the cfoutput FORM removeChars cfoutput middle characters of this string because it is not long enough cfelse p Your original string cfoutput FORM myText cfoutput p Your changed string showing on...

Страница 626: ...IsNumeric FORM myNum2 p The maximum of the two numbers is cfoutput Max FORM myNum1 FORM myNum2 cfoutput p The minimum of the two numbers is cfoutput Min FORM myNum1 FORM myNum2 cfoutput cfelse p Plea...

Страница 627: ...sh Second 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 Example h3 Min...

Страница 628: ...the date parameter of this function for example Month CreateDate 2001 3 3 Example h3 Month Example h3 cfif IsDefined FORM year More information about your date cfset yourDate CreateDate FORM year FOR...

Страница 629: ...bout your date cfset yourDate CreateDate FORM year FORM month FORM day cfoutput p Your date DateFormat yourDate br It is DayofWeekAsString DayOfWeek yourDate day DayOfWeek yourDate in the week br This...

Страница 630: ...OfMonth Returns A date time object the current date and time of the computer running the ColdFusion server Category Date and time functions Function syntax Now See also CreateDateTime DatePart Example...

Страница 631: ...nds the decimal part as ColdFusion 5 does For example it rounds 34 567 to 35 Parameters The following table explains mask characters Parameter Description number A number mask A string or a variable t...

Страница 632: ...formats The positioning can also show where to place the minus sign for negative numbers The positions for a symbol are far left near left near right and far right The left and right positions are det...

Страница 633: ...e of 1 28 If you round off a double such as 1 99499999999999999999999999999 where the last decimal is 10E 14 the rounding factor can cause an incorrect result To set the default display format of date...

Страница 634: ...elds Example h3 ParagraphFormat Example h3 p Enter text into this textarea and see it returned as HTML cfif IsDefined FORM myTextArea p Your text area formatted p cfoutput ParagraphFormat FORM myTextA...

Страница 635: ...on 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 wo...

Страница 636: ...and currency values use the SetLocale function Note This function does not accept POP dates Example h3 ParseDateTime Example h3 cfif IsDefined form theTestValue cfif IsDate form theTestValue h3 The ex...

Страница 637: ...ScriptName method POST p Enter an expression and discover if it can be evaluated to a date value input type Text name TheTestValue value CFOUTPUT DateFormat Now TimeFormat Now CFOUTPUT input type Subm...

Страница 638: ...79 Category Mathematical functions Function syntax Pi See also ASin Cos Sin Tan Example h3 Pi Example h3 By default ColdFusion displays only 11 significant digits Use NumberFormat to display all 15 Th...

Страница 639: ...ble reference until runtime This prevents errors that result from the evaluation of a single quote or apostrophe data character for example Joe s Diner as a delimiter Example A Consider this code cfse...

Страница 640: ...ancisco and San Diego using the SQL grammar IN to modify a WHERE clause rather than looping through the result set after the query is run cfset List Suisun San Francisco San Diego cfquery name GetCent...

Страница 641: ...so DatePart Month 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 Exampl...

Страница 642: ...as queries retrieved with the cfquery tag or queries created with the QueryNew function You cannot us the QueryAddColumn function on a cached query Useful for generating a query object from the array...

Страница 643: ...1 cfset HealthFoodArray 1 Bean Curd cfset HealthFoodArray 2 Yogurt cfset HealthFoodArray 3 Tofu add a third column to the query cfset nColumnNumber3 QueryAddColumn myQuery HealthFood HealthFoodArray...

Страница 644: ...query p The Query GetCourses has cfoutput GetCourses RecordCount cfoutput rows cfset CountVar 0 cfloop CONDITION CountVar LT 15 cfset temp QueryAddRow GetCourses cfset CountVar CountVar 1 cfset Temp Q...

Страница 645: ...ddress phone make some rows in the query cfset newRow QueryAddRow MyQuery 2 set the cells in the query cfset temp QuerySetCell myQuery name Fred 1 cfset temp QuerySetCell myQuery address 9 Any Lane 1...

Страница 646: ...Courses cfquery p The Query GetCourses has cfoutput GetCourses RecordCount cfoutput rows cfset CountVar 0 cfloop CONDITION CountVar LT 15 cfset temp QueryAddRow GetCourses cfset CountVar CountVar 1 c...

Страница 647: ...get the department IDs in our list cfquery name GetDepartments datasource cfsnippets SELECT Dept_ID FROM Departments WHERE Dept_ID IN PreserveSingleQuotes List cfquery now select the courses for that...

Страница 648: ...nge 0 1 Category Mathematical functions Function syntax Rand See also Randomize RandRange Usage To ensure greater randomness call the Randomize function before calling Rand Example h3 Rand Example h3...

Страница 649: ...er it is not a random number Example h3 Randomize Example h3 p Call Randomize to seed the random number generator This helps to ensure the randomness of numbers generated by Rand cfif IsDefined FORM m...

Страница 650: ...RandRange returns an integer between two specified integers cfif IsDefined FORM myInt p RandRange returned cfoutput RandRange FORM myInt FORM myInt2 cfoutput cfif cfform action randRange cfm p Enter...

Страница 651: ...ows If the regular expression is found in the string the first element of the len and pos arrays contains the length and position respectively of the first match of the entire regular expression If th...

Страница 652: ...rns the position and length of the first occurrence of a regular expression in a string starting from the specified position The position and length variables are stored in a structure To access posit...

Страница 653: ...e position and length of the first instance of each parenthesized subexpression within is included in additional array elements p p For example lt CFSET st1 REFind alpha 1 testString 1 TRUE gt p cfset...

Страница 654: ...is found in the string the first element of the len and pos arrays contains the length and position respectively of the first match of the entire regular expression If the regular expression contains...

Страница 655: ...i returnssubexpression i parameter REFindNoCase returns the position and length of the first occurrence of a regular expression in a string starting from the specified position The position and lengt...

Страница 656: ...n and length of the first instance of the whole expression The position and length of the first instance of each subexpression within will be included in additional array elements p p For example lt C...

Страница 657: ...as a quit method that terminates the program call this method before you call the ReleaseComObject function This function can improve processing efficiency but is not required for an application to w...

Страница 658: ...urns 0 if no characters are found cfif IsDefined FORM myString cfif FORM numChars FORM start GT Len FORM myString p Your string is only cfoutput Len FORM myString cfoutput characters long Please enter...

Страница 659: ...3 p RepeatString returns a string created from I string I repeated a specified number of times ul li RepeatString 10 cfoutput RepeatString 10 cfoutput li RepeatString lt BR gt 3 cfoutput RepeatString...

Страница 660: ...azy cow dog and cat All Example h3 Replace Example h3 p The Replace function returns I string I with I substring1 I replaced by I substring2 I in the specified scope This is a case sensitive search cf...

Страница 661: ...string cfoutput FORM MyString cfoutput p You wanted to replace the substring cfoutput FORM MySubstring1 cfoutput with the substring cfoutput FORM MySubstring2 cfoutput p The result cfoutput Replaceli...

Страница 662: ...662 Chapter 3 ColdFusion Functions replacelist stringtoreplace dog brown fox black cow black ferret white cfoutput...

Страница 663: ...the specified scope The search replace is case insensitive cfif IsDefined FORM MyString p Your original string cfoutput FORM MyString cfoutput p You wanted to replace the substring cfoutput FORM MySu...

Страница 664: ...ing scope See also REFind Replace ReplaceList REReplaceNoCase History ColdFusion MX Added supports for the following special codes in a replacement substring to control case conversion u uppercase the...

Страница 665: ...p REReplace CABARET C B G ALL cfoutput REReplace CABARET C B G ALL cfoutput p REReplace CABARET A Z G ALL cfoutput REReplace CABARET A Z G ALL cfoutput p REReplace I love jellies jell y ies cookies c...

Страница 666: ...usion 5 application you must insert a backslash before it for example change u to u Parameters Usage For details on using regular expressions see Chapter 7 Using Regular Expressions in Functions in De...

Страница 667: ...ReplaceNoCase 667 cfoutput REReplaceNoCase I LOVE JELLIES jell y ies cookies cfoutput p REReplaceNoCase I LOVE JELLY jell y ies cookies cfoutput REReplaceNoCase I LOVE JELLY jell y ies cookies cfoutpu...

Страница 668: ...as the following cfoutput reverse 6 2 equals reverse 6 2 cfoutput This code outputs the following reverse 6 2 equals 21 Example h3 Reverse Example h3 p Reverse returns your string with the positions...

Страница 669: ...0 then err cfif Len FORM myText is not 0 cfif Len FORM myText LTE FORM RemoveChars p Your string cfoutput FORM myText cfoutput only has cfoutput Len FORM myText cfoutput characters You cannot output t...

Страница 670: ...ult cfif IsDefined FORM justifyString cfset jstring rjustify FORM justifyString 35 cfif html head title RJustify Example title head body h3 RJustify Function h3 p Enter a string It will be right justi...

Страница 671: ...Ceiling Fix Int Parameters Example h3 Round Example h3 p This function rounds a number to the closest integer ul li Round 7 49 cfoutput Round 7 49 cfoutput li Round 7 5 cfoutput Round 7 5 cfoutput li...

Страница 672: ...im Parameters Example h3 RTrim Example h3 cfif IsDefined FORM myText cfoutput pre Your string FORM myText Your string RTrim FORM myText right trimmed pre cfoutput cfif form action Rtrim cfm method pos...

Страница 673: ...rs Usage When passing a date time object as a string you must enclose it in quotation marks Otherwise it is interpreted as a number representation of a date time object Example This example shows the...

Страница 674: ...r the character encoding of a URL is not in UTF 8 encoding For example Traditional Chinese characters are often in Big5 encoding Before using URL or Form variables call this function typically in the...

Страница 675: ...ally use in the SetEncoding charset parameter and other ColdFusion attributes and parameters Java automatically converts standard IANA names to its internal names as needed Example This example sends...

Страница 676: ...Java standard locale determination and formatting rules on all platforms Deprecated the Spanish Mexican locale option It might not work and it might cause an error in later releases Changed the Spanis...

Страница 677: ...uage specified by the Content Language header ColdFusion ignores any SetLocale functions that follow a cfflush tag Because this function returns the previous locale setting you can save the original l...

Страница 678: ...ation path and timeout value to the path and timeout value specified in the form cfif Isdefined Form Submit cfset IniPath FORM iniPath cfset Section boot loader cfset MyTimeout FORM MyTimeout cfset ti...

Страница 679: ...Loader h4 p Timeout is set to cfoutput timeout cfoutput p p Default directory is cfoutput default cfoutput p cfif form action setprofilestring cfm hr size 2 color 0000A0 table cellspacing 2 cellpaddin...

Страница 680: ...variables To do so put the dynamically named variable in quotation marks and pound signs for example cfset DynamicVar2 ABD cfset DynamicVar2 Test Value2 Also the following lines are equivalent cfset...

Страница 681: ...SetVariable 681 p Your variable varName p The value of varName is varNameValue cfoutput cfif...

Страница 682: ...Mathematical functions Function syntax Sgn number See also Abs Parameters Example h3 Sgn Example h3 p Sgn determines the sign of a number Returns 1 if number is positive 0 if number is 0 1 if number...

Страница 683: ...000000000001 Example h3 Sin Example h3 Calculate sine if form has been submitted cfif IsDefined FORM sinNum Make sure input is a number cfif IsNumeric FORM sinNum Convert degrees to radians call the S...

Страница 684: ...684 Chapter 3 ColdFusion Functions br br input type Submit name nbsp nbsp input type RESET form...

Страница 685: ...t FORM myString cfoutput p Your set of characters was cfoutput FORM mySet cfoutput p Your string up until one of the characters in the set is cfoutput SpanExcluding FORM myString FORM mySet cfoutput c...

Страница 686: ...myString cfoutput p Your set of characters was cfoutput FORM mySet cfoutput p Your string until the characters in the set have been found is cfoutput SpanIncluding FORM myString FORM mySet cfoutput cf...

Страница 687: ...Parameters Usage The value in number must be greater than or equal to 0 Example h3 Sqr Example h3 p Returns the square root of a positive number p Sqr 2 cfoutput Sqr 2 cfoutput p Sqr Abs 144 cfoutput...

Страница 688: ...pCR Example h3 p Function StripCR is useful for preformatted HTML display of data PRE entered in textarea fields cfif isdefined Form myTextArea pre cfoutput StripCR Form myTextArea cfoutput pre cfif u...

Страница 689: ...ruct2 overwrites it A structure s keys are unordered Example html body Create a Name structure cfset nameCLK StructNew cfset nameCLK first Chris cfset nameCLK middle Lloyd cfset nameCLK last Gilson Cr...

Страница 690: ...em cfoutput myItem br cfoutput cfloop Merge the Name struct into the top level person struct cfset bSuccess StructAppend personCLK addrCLK Display the contents of the person struct after the Append p...

Страница 691: ...4 5 5 x and ColdFusion MX Example Shows StructClear function Calls cf_addemployee custom tag which uses the addemployee cfm file body h1 Add New Employees h1 Establish params for first time through c...

Страница 692: ...692 Chapter 3 ColdFusion Functions Call the custom tag that adds employees cf_addemployee empinfo employee cfscript StructClear employee cfscript cfif...

Страница 693: ...at the top level cfoutput cfset assignedCopy StructNew cfset assignedCopy string struct string cfset assignedCopy number struct number cfset assignedCopy array ArrayNew 2 cfset assignedCopy array 1 1...

Страница 694: ...s string br Array value br s array 1 1 s array 1 1 br s array 1 2 s array 1 2 br cfoutput Copy this structure to a new structure br cfset copied StructCopy s cfscript Change the values of the origina...

Страница 695: ...ed string br Array values br s nested array 1 1 s nested array 1 1 br s nested array 1 2 s nested array 1 2 br cfoutput Use StructCopy to copy this structure to a new structure br cfset copied StructC...

Страница 696: ...pied nested array 1 2 copied nested array 1 2 br cfoutput hr b Duplicated structure values should remain unchanged b br cfoutput Simple values br duplicated nested number duplicated nested number br d...

Страница 697: ...appropriate place in addemployee cfm cfswitch expression ThisTag ExecutionMode cfcase value start cfif StructIsEmpty attributes EMPINFO cfoutput Error No employee data was passed cfoutput cfexit metho...

Страница 698: ...fault Mary cfparam name lastname default Sante cfparam name email default msante allaire com cfparam name phone default 777 777 7777 cfparam name department default Documentation cfif IsDefined FORM D...

Страница 699: ...r employee br cfoutput cfif br br form method post action CGI Script_Name p Select the field to be deleted nbsp select name field option value firstname first name option value lastname last name opti...

Страница 700: ...ed through the employee structure EMPINFO attribute In UNIX you must also add the Emp_ID cfswitch expression ThisTag ExecutionMode cfcase value start cfif StructIsEmpty attributes EMPINFO cfoutput Err...

Страница 701: ...that includes one structure for each of the specified values it finds The fields of each of these structures are Value value held in the found key Path string that can be used to reach the found key O...

Страница 702: ...Usage The fields of each structure in the returned array are Key name of the key in which the value was found Path string which could be used to reach the found key Owner parent object that contains t...

Страница 703: ...path Parameters Usage You can inadvertently create invalid structures using this function For example if array notation is used to expand an existing array the specified new element is created regard...

Страница 704: ...s cfoutput cfset test StructGet request myscope 1 test cfset test foo 2 cfoutput request myscope 1 test foo br cfoutput cfset test StructGet request myscope 1 test 2 cfset test foo 3 cfoutput request...

Страница 705: ...for first time through cfparam name FORM firstname default cfparam name FORM lastname default cfparam name FORM email default cfparam name FORM phone default cfparam name FORM department default cfif...

Страница 706: ...custom tag that adds employees CF_ADDEMPLOYEE EMPINFO employee cfif Hr form action structinsert cfm p First Name nbsp input name firstname type text hspace 30 maxlength 30 p Last Name nbsp input name...

Страница 707: ...tion is passed through employee structure EMPINFO attribute In UNIX you must also add the Emp_ID cfswitch expression ThisTag ExecutionMode cfcase value start cfif StructIsEmpty attributes EMPINFO cfou...

Страница 708: ...loyee structure with user entries on form cfset employee StructNew cfif Isdefined Form Submit cfif Form Submit is OK cfset employee firstname FORM firstname cfset employee lastname FORM lastname cfset...

Страница 709: ...ength 20 td tr tr td Company td td input name company type text value hspace 30 maxlength 30 td tr tr td input type submit name submit value OK td td b After you submit the FORM scroll down to see the...

Страница 710: ...ys are unordered Example This example shows the use of StructKeyExists p This file is similar to addemployee cfm which is called by StructNew StructClear and StructDelete To test copy the LT CFELSEif...

Страница 711: ...yee structure with what the user entered in the form cfset employee StructNew cfif Isdefined Form Submit cfif Form Submit is OK cfset employee firstname FORM firstname cfset employee lastname FORM las...

Страница 712: ...e text value hspace 30 maxlength 30 td tr tr td EMail td td input name email type text value hspace 30 maxlength 30 td tr tr td Phone td td input name phone type text value hspace 20 maxlength 20 td t...

Страница 713: ...param name FORM department default cfif FORM firstname EQ p Please fill out the form cfelse cfoutput cfscript employee StructNew StructInsert employee firstname FORM firstname StructInsert employee la...

Страница 714: ...s function does not sort or change the structure Example cfscript salaries StructNew employees StructNew departments StructNew for i 1 i lt 6 i i 1 salary 120000 i 10000 salaries employee i salary emp...

Страница 715: ...laries numeric DESC br p list of employees based on the salary subfield search br 7 ArrayToList StructSort employees numeric DESC salary br 8 ArrayToList StructSort employees text ASC salary br p list...

Страница 716: ...StructDelete To test this file copy the LT CFELSEIF GT statement to the appropriate place in addemployee cfm It is an example of a custom tag used to add employees Employee information is passed thro...

Страница 717: ...less than 0 0000000000001 To test for an infinite value check whether the value is more than 1E15 Example h3 Tan Example h3 Calculate tangent if form has been submitted cfif IsDefined FORM tanNum Mak...

Страница 718: ...718 Chapter 3 ColdFusion Functions br input type Text name tanNum size 15 br br input type Submit name nbsp nbsp input type RESET form...

Страница 719: ...usion MX Changed the way extra characters are processed this function processes extra characters within the mask value differently than in earlier releases as follows ColdFusion 5 and earlier the func...

Страница 720: ...todayDate cfoutput p Using Timeformat we can display the value in different ways cfoutput ul li TimeFormat todayDate li TimeFormat todayDate hh mm ss li TimeFormat todayDate hh mm sst li TimeFormat t...

Страница 721: ...Usage Base64 provides 6 bit encoding of data The encoding process represents 24 bit groups of input bits as output strings of 4 encoded ASCII characters Binary objects and in some cases 8 bit charact...

Страница 722: ...index data from 32 to 255 cfset ch chr data cfset charData charData ch cfloop p The following string is the concatenation of all characters 32 to 255 from the ASCII table br cfoutput charData cfoutput...

Страница 723: ...le file Example h3 ToBinary Example h3 Initialize data cfset charData Create a string of ASCII characters 32 255 concatenate them cfloop index data from 32 to 255 cfset ch chr data cfset charData char...

Страница 724: ...724 Chapter 3 ColdFusion Functions cfelse h3 Conversion error h3 cfif...

Страница 725: ...tion cannot convert a value it throws an exception This function can convert an XML document object to a string representation Note You can use this function to reverse Base64 encoding of a string Con...

Страница 726: ...32 to 255 from the ASCII table br cfoutput charData cfoutput p Create a Base64 representation of this string cfset data64 toBase64 charData p The following string is the Base64 representation of the s...

Страница 727: ...ers Example h3 Trim Example h3 cfif IsDefined FORM myText cfoutput pre Your string FORM myText Your string Trim FORM myText trimmed on both sides pre cfoutput cfif form action trim cfm p Type in some...

Страница 728: ...cfif IsDefined FORM sampleText cfif FORM sampleText is not p Your text cfoutput FORM sampleText cfoutput returned in uppercase is cfoutput UCase FORM sampleText cfoutput cfelse p Please enter some tex...

Страница 729: ...ed the charset parameter Parameters 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...

Страница 730: ...ASCII character codes cfscript Build string s for c 1 c lte 256 c c 1 s s chr c Encode string and display result enc URLEncodedFormat s WriteOutput Encoded string is enc br Decode and compare result...

Страница 731: ...ded the charset parameter Parameters 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...

Страница 732: ...ple was passed from the previous link its value is br b cfoutput url myExample cfoutput b cfif p This function returns a URL encoded string cfset s My url encoded string has special characters other s...

Страница 733: ...nds only required information when it is required and it is easier to code Returns A URL if cookies are disabled for the browser client and session data are appended Category Other functions Function...

Страница 734: ...TestValue 0 Val TestValue returns the value 0 not an error Example h3 Val Example h3 cfif IsDefined FORM theTestValue cfif Val FORM theTestValue is not 0 h3 The string cfoutput DE FORM theTestValue c...

Страница 735: ...3 use the contents of a query to create another dynamically cfquery name GetDepartments datasource cfsnippets SELECT Dept_ID FROM Departments WHERE Dept_ID IN BIOL cfquery cfquery name GetCourseList d...

Страница 736: ...k Example h3 cfif IsDefined FORM year More information about your date cfset yourDate CreateDate FORM year FORM month FORM day cfoutput p Your date DateFormat yourDate br It is DayOfWeekAsString DayOf...

Страница 737: ...ne on Windows If you specify the strip parameter all existing line breaks are removed so any paragraph formatting is lost Use this function to limit the length of text lines such as text to be include...

Страница 738: ...the current SQL statement or mail text Do not use WriteOutput within cfquery and cfmail Although you can call this function anywhere within a page it is most useful inside a cfscript block Example cf...

Страница 739: ...XmlChildPos XmlFormat XmlNew XmlParse XmlSearch XmlTransform History ColdFusion MX Added this function Parameters Usage The returned index can be used in the ArrayInsertAt and ArrayDeleteAt functions...

Страница 740: ...information on this example see Chapter 31 Using XML and WDDX in Developing ColdFusion MX Applications cfset testVar True cfscript MyDoc XmlNew MyDoc xmlRoot XmlElemNew MyDoc MyRoot if testVar IS TRU...

Страница 741: ...Added this function Parameters Usage The characters that this function escapes include the following Greater than symbol Less than symbol Single quotation mark Double quotation mark Ampersand symbol...

Страница 742: ...yee name 1 and mydoc employee NAME 1 refer to the same element If caseSensitive yes these names refer to two distinct elements The following example creates and displays a ColdFusion document object F...

Страница 743: ...XmlNew 743 cfscript cfdump var MyDoc...

Страница 744: ...resented by a string variable use the XmlParse tag directly on the variable For example if your application uses cfhttp action get to get the XML document use the following code to create the XML docu...

Страница 745: ...Usage XPath is specified by the World Wide Web Consortium For detailed information on XPath see the W3C website at www w3 org TR xpath Example The following example extracts the elements named last w...

Страница 746: ...Chapter 31 Using XML and WDDX in Developing ColdFusion MX Applications Returns A string an XML document after the XSLT is applied Category Conversion functions Extensibility functions XML functions Fu...

Страница 747: ...e information about your date cfset yourDate CreateDate FORM year FORM month FORM day cfoutput p Your date DateFormat yourDate br It is DayOfWeekAsString DayOfWeek yourDate day DayOfWeek yourDate in t...

Страница 748: ...x YesNoFormat value See also IsBinary IsNumeric Parameters Example h3 YesNoFormat Example h3 p The YesNoFormat function returns non zero values as Yes zero values as No cfoutput ul li YesNoFormat 1 Ye...

Страница 749: ...on C CFX Reference This chapter describes the CFXAPI classes and members Contents C class overview 750 Deprecated class members 750 CCFXException class 751 CCFXQuery class 753 CCFXRequest class 757 CC...

Страница 750: ...CCFXRequest AddQuery CCFXRequest AttributeExists CCFXRequest CreateStringSet CCFXRequest Debug CCFXRequest GetAttribute CCFXRequest GetAttributeList CCFXRequest GetCustomData CCFXRequest GetQuery CCFX...

Страница 751: ...eption and CCFXRequest ReThrowException Class members CCFXException GetError Description Provides basic user output for exceptions that occur during processing CCFXException GetDiagnostics Description...

Страница 752: ...ceptions re raise them catch CCFXException e This is how you would pull the error information LPCTSTR strError e GetError LPCTSTR strDiagnostic e GetDiagnostics pRequest ReThrowException e Catch ALL o...

Страница 753: ...w iCity St Paul pQuery SetData iRow iState MN pQuery SetData iRow iZip 55105 virtual int AddRow CCFXQuery AddRow adds a row to a query virtual CCFXStringSet GetColumns CCFXQuery GetColumns retrieves a...

Страница 754: ...olumns int nNumColumns pColumns GetCount Print the list of columns to the user pRequest Write Columns in query for int i 1 i nNumColumns i pRequest Write pColumns GetString i pRequest Write CCFXQuery...

Страница 755: ...XQuery GetName void Description Returns the name of a query Example The following example retrieves the name of a query and writes it back to the user CCFXQuery pQuery pRequest GetQuery pRequest Write...

Страница 756: ...r call to SetData Parameters 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 Min...

Страница 757: ...R lpszSettingName CCFXRequest GetSetting This member is deprecated It might not work and might cause an error in later releases virtual void Write LPCSTR lpszOutput CCFXRequest Write writes text outpu...

Страница 758: ...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 CreateStringSet int iFirstName pColumns AddStr...

Страница 759: ...NATION parameter in order for this tag to work correctly CCFXRequest CreateStringSet Syntax CCFXStringSet CCFXRequest CreateStringSet void Description Allocates and returns an instance Always use this...

Страница 760: ...fo CCFXRequest GetAttribute Syntax LPCSTR CCFXRequest GetAttribute LPCSTR lpszName Description Retrieves the value of the passed attribute Returns an empty string if the attribute does not exist To te...

Страница 761: ...st GetAttributeList int nNumAttribs pAttribs GetCount for int i 1 i nNumAttribs i lpszName pAttribs GetString i lpszValue pRequest GetAttribute lpszName pRequest Write lpszName pRequest Write pRequest...

Страница 762: ...is completed 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 Thro...

Страница 763: ...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...

Страница 764: ...formed by the custom tag BOOL bMessageSent attempt to send the message if bMessageSent TRUE pRequest SetVariable MessageSent Yes else pRequest SetVariable MessageSent No CCFXRequest ThrowException Syn...

Страница 765: ...the buffer with data and writes the output back to the user CHAR buffOutput 1024 wsprintf buffOutput The destination is s pRequest GetAttribute DESTINATION pRequest Write buffOutput CCFXRequest Write...

Страница 766: ...eStringSet int iRed pSet AddString Red int iGreen pSet AddString Green int iBlue pSet AddString Blue CCFXStringSet GetCount Syntax int CCFXStringSet GetCount void Description Gets the number of string...

Страница 767: ...ensitive Returns If the string is found its index within the string set is returned If it is not found the constant CFX_STRING_NOT_FOUND is returned Parameters Example The following example demonstrat...

Страница 768: ...ollowing example demonstrates GetString with CCFXStringSet GetCount to iterate over a string set and write the contents of a list back to the user int nNumItems pStringSet GetCount for int i 1 i nNumI...

Страница 769: ...hapter describes the Java interfaces available for building ColdFusion custom CFXs in Java Contents Overview class libraries 770 CustomTag interface 770 Query interface 772 Request interface 777 Respo...

Страница 770: ...FX_MyCustomTag Other attributes can be passed to the Java CFX tag Their values are available using the Request object passed to the processRequest method Methods processRequest Description Processes a...

Страница 771: ...est request Response response Throws Exception If an unexpected error occurs while processing the request Parameters Parameter Description request Parameters attributes query and so on for this reques...

Страница 772: ...columns City State and Zip Define column indexes 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 5...

Страница 773: ...il query getColumnIndex EMAIL Iterate over the query and output list of addresses int nRows query getRowCount for int iRow 1 iRow nRows iRow response write query getData iRow iEMail BR getColumns Desc...

Страница 774: ...quested data element Category Query interface Syntax public String getData int iRow int iCol Throws IndexOutOfBoundsException If an invalid index is passed to the method See also setData addRow Parame...

Страница 775: ...ublic int getRowCount 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 nu...

Страница 776: ...xes 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 setDa...

Страница 777: ...tag if not it throws an exception if request attributeExists DESTINATION throw new Exception Returns Syntax Description boolean attributeExists String name Checks whether the attribute was passed to...

Страница 778: ...attribute is present and if so it writes a brief debug message if request debug response writeDebug debug info getAttribute Description Retrieves the value of a passed attribute Returns an empty strin...

Страница 779: ...trieves the list of attributes then iterates over the list writing each attribute and its value back to the user String attribs request getAttributeList int nNumAttribs attribs length for int i 0 i nN...

Страница 780: ...g the cfquery tag The query attribute is optional and should be used only by tags that process an existing dataset Returns the Query that was passed to the tag If no query was passed returns null Cate...

Страница 781: ...share a registry key for storing settings To avoid name conflicts preface the names of settings with the name of your custom tag class For example the code below retrieves the value of a setting name...

Страница 782: ...n If the name parameter is not a valid CFML variable name See also addRow setData Parameters Example The following example adds a query named People to the calling template The query has two columns F...

Страница 783: ...variable is created Category Response interface Syntax public void setVariable String name String value Throws IllegalArgumentException If the name parameter is not a valid CFML variable name Paramete...

Страница 784: ...text output into the debug stream This text is displayed to the end user only if the tag contains the debug attribute check for this attribute using the Request debug member function Category Respons...

Страница 785: ...ith attributes and a query public DebugRequest Hashtable attributes Query query initialize a debug request with attributes a query and settings public DebugRequest Hashtable attributes Query query Has...

Страница 786: ...786 Chapter 5 ColdFusion Java CFX Reference...

Страница 787: ...vaScript Objects This chapter provides information about JavaScript objects and functions used to WDDX in a ColdFusion application Contents JavaScript object overview 788 WddxSerializer object 789 Wdd...

Страница 788: ...nstalled in the webroot cfide scripts directory To use these objects you must put a JavaScript tag before the code that refers to the objects for example script type text javascript src CFIDE scripts...

Страница 789: ...erialize a WddxRecordset instance It copies serialized data to a form field for display function serializeData data formField wddxSerializer new WddxSerializer wddxPacket wddxSerializer serialize data...

Страница 790: ...s Usage This is an internal function you do not typically call it Example This example is from the WddxSerializer serializeValue function Some generic object treat it as a structure this write struct...

Страница 791: ...wddxPacket this write wddxPacket version 1 0 header data bSuccess this serializeValue rootObj this write data wddxPacket if bSuccess return this wddxPacket else return null write Description Appends d...

Страница 792: ...nternal function you do not typically call it Example This example is from the WddxSerializer serializeValue function else if typeof obj number Number value this write number obj number else if typeof...

Страница 793: ...cripts wddx js script script Use WDDX to move from CFML data to JS cfwddx action cfml2js input q topLevelVariable qj Dump the record set document write qj dump true script addColumn Description Adds a...

Страница 794: ...alue is a previously defined variable rs setField 0 NewColumn newValue addRows Description Adds rows to all columns in a WddxRecordset instance Syntax object addRows n Parameters Return value None Usa...

Страница 795: ...ct getField row col Parameters Return value Returns the value in the specified row column position Usage Call this function to access a value in a WDDX record set Example This example calls the getFie...

Страница 796: ...t function function dumpWddxRecordset r Get row count nRows r getRowCount for row 0 row nRows row setField Description Sets the element in the specified row column position Syntax object setField row...

Страница 797: ...xSerialize serializer Parameters Return value Returns a Boolean True if serialization was successful or False if an error occurs Usage This is an internal function you do not typically call it Example...

Страница 798: ...798 Chapter 6 WDDX JavaScript Objects...

Страница 799: ...799 CHAPTER 7 ColdFusion ActionScript Functions This chapter explains the syntax and usage of the two server side ActionScript functions CF query and CF http Contents CF query 800 CF http 801...

Страница 800: ...CF query function using positional arguments CF query datasource sql CF query datasource sql maxrows CF query datasource sql username password CF query datasource sql username password maxrows Note Do...

Страница 801: ...arks return result Example function declaration using named arguments function basicQuery result CF query datasource cust_data sql SELECT from tblParks return result Example of the CF query function u...

Страница 802: ...sername Optional When required by a server a username password Optional When required by a server a password resolveurl Optional For Get and Post methods Yes or No Default is No For GET and POST opera...

Страница 803: ...ion returns data as a set of object properties as described in the following table path Optional The path to the directory in which to store files When using the path argument the file argument is req...

Страница 804: ...Path file foo txt Header Raw response header For example macromedia com returns the following header HTTP 1 1 200 OK Date Mon 04 Mar 2002 17 27 44 GMT Server Apache 1 3 22 Unix mod_perl 1 26 Set Cooki...

Страница 805: ...uments function postWithParams Set up the array of Post parameters These are just like cfhttpparam tags params new Array params 1 name arg2 type URL value value2 url http localhost 8100 Invoke with th...

Страница 806: ...806 Chapter 7 ColdFusion ActionScript Functions...

Отзывы: