ColdFusion Language





ColdFusion is a server-side rapid application development platform originally created by Allaire and now sold by Adobe, implementing the dynamic general purpose CFML programming language. The term ColdFusion is sometimes colloquially used to refer to the CFML language (Cold Fusion Markup Language), but can also include discussions of the server software implementation. ColdFusion runs using a customised version of Apache Tomcat. Earlier versions are bundled with JRun.

Share tech news, updates, or what's on your mind.

Sign up to Post

How to copy large DAT files  1.36 GB from FTP to application server. Coldfusion was used earlier but it hungup at this file. we have SSIS too.

Reason they used CF earlier cause its actually parsing the copied file.
Build an E-Commerce Site with Angular 5
LVL 13
Build an E-Commerce Site with Angular 5

Learn how to build an E-Commerce site with Angular 5, a JavaScript framework used by developers to build web, desktop, and mobile applications.

Have a main.cfm page that has an cfinclude to a JavaScript page that retrieves data from a cfc file and returns the results in a datatable and displays on my main.cfm page. The table is always less than 5 rows and can be edited. I also have a submit button that runs cfscript on another page that also retrieves other sets of data and exports to an excel workbook.
So my issue/question is how can I pass my displayed table with changes on the main page to this cfscript page and export with the rest of my data? I assume there's a way to pass the table data to another page. Been searching for a way to pass as is or in a array-structure of some sort.

Using ColdFusion, JavaScript.
Trying to pass a form value from page to page to page. On the first page have a dropdown inside a form and passes value to my next page. On that next page, I have this code:
<cfparam name="Form.SerialNumber" default="">

I have an cfinclude statement that passes that on to another page that works fine. But I also have a form on this same page that I want to pass the SerialNumber onto. So I tried this within a form:
<form name="ChartExport" id="ChartExport" action="ChartExportProcess.cfm" method="post">
        	<INPUT type="hidden" name="SerialNumber" VALUE="#Form.SerialNumber#">
        <h6>Click on "DownLoad Files" to export to excel for processing</h6>
        <p align="center">
          <input name="btnsubmit" type="submit" class="btnsubmit" value="Download Files">

Open in new window

so on the ChartExportProcess.cfm page I tried this for a test:
<cfparam name="Form.Dodic" default="">
<cfdump var="#Form.Dodic#" >

But I just get #Form.Dodic#.

What am I doing wrong? would try session but at the moment not an option.
I have created a website using mostly Lucee (coldfusion) but it also has some javascript code, php and a MySQL database. I would like to use the same code for a new website and it would use its own database. What is the best way to copy over the files? One option is to use FTP to upload the files but that takes a long time since there are a lot of files. Is there a way to package the files into one file and then install it for the new website?

Also, I have noticed that a copy of my cfm and cfc files are found in a directory called cfclasses and they have been renamed. It seems that *.cfm have been renamed to *_cfm$cf.class and *.cfc have been renamed to *_cfc$cf.class. Are these precompiled files? Can I use these files instead to speed up loading of the site and so that I don't have to give away my source? If so do I have to rename all of these files back to their original names? Is there a fast way to do this?
I'm working on creating a specific table of contents structure on a web page, from data in a SQL database. The display includes indenting levels and prefixed symbols. The symbols, in order are:
Roman numerals, Upper case letters, Numbers, Lower case letters, Numbers in parenthesis, Lower case letters in parenthesis.
I. yadda
     A. yadda
     B. yadda
         1. yadda
               a. yadda
               b. yadda
         2. yadda
               a. yadda
               b. yadda
                     (1) yadda
                     (2) yadda
                              (a) yadda
                              (b) yadda

II. yadda

I'd like some help in creating this format with dynamic data. The indention and the top level Roman Numbers are working fine but it's the recursion of all the other symbols is where I could use a little help.  

Here are the sql fields I'm returning:

indentAmount, headingCount, headingName, headingText

indentAmount is the number of levels to indent. example: 0, 1, 2, 3, etc..
headingCount is the number of items for a given heading. example: 1, 2, 3. etc..
headingName is the actual name of the heading. example H2, H3, H4... etc.
headingText is the heading text itself.  In my example it's "Yadda".

Here is the query I'm running:

select h.sectionID,
WHEN h.HeadingTitle = 'Heading2' THEN 0
WHEN h.HeadingTitle = 'Heading3' THEN …
Excel's formula RATE is used to get the interest rate per period of an annuity

=RATE (nper, pmt, pv, [fv], [type], [guess])
nper - The total number of payment periods.
pmt - The payment made each period.fv - [optional] The future value, or desired cash balance after last payment. Default is 0.
type - [optional] When payments are due. 0 = end of period. 1 = beginning of period. Default is 0.
guess - [optional] Your guess on the rate. Default is 10%.
pv - The present value, or total value of all loan payments now.

I am trying to mimic the RATE formula in ColdFusion and have been successful until a certain point (see example below).

For nPER > 43 my Coldfusion function returns the wrong result.

Excel result : =RATE(44,223.51,-5000) =  0.03476
Coldfusion result : 0.0135061661

Any help is greatly appreciated

<cfloop index="nIdx" from="1" to="99">
		<cfinvoke   method="getAPR2" returnvariable="nAPR">
		    <cfinvokeargument name="parmLoan"  value="5000">
		    <cfinvokeargument name="parmDuration"  value="#nIdx#">
		    <cfinvokeargument name="parmMonthlyPayment"  value="223.51">

		<cfdump var = "#nIdx#"> .... <cfdump var = "#nApr#"><br>


    getAPR2 - 2019-09-01 using Central Bank's document
<cffunction name="getAPR2" returntype ="numeric">
    <cfargument name="parmLoan" required="true"

Open in new window

Using a ColdFusion function to return query results and was working fine.  Was required to change how I returned the data to SerializeJSON(). But when doing this, nothing returns. Not sure what the issue is unless it has to do with script sources.
I minimized the code to hopefully make it easier to follow. Test.cfm displays the results. TestJS is the JavaScript to call and return the data from Test.cfc file. The last bit of code is what I had that was working. Any ideas? CFDump will return results as well.


<!DOCTYPE html>
<html lang="en-US">
		<link rel="stylesheet" type="text/css" href="">
		<link rel="stylesheet" type="text/css" href="">
		<script src=""></script>
		<script src=""></script>
		<script src=""></script>
		<script src=""></script>
		<script src=""></script>
		<script src=""></script>
		<script src=""></script>

Open in new window

Using ColdFusion 2016. I have a invoke call to run a stored procedure file. Just does some updates on the server with no return value. Not sure how to let user know complete after ran.

<cfinvoke component="model/Process" method="Drawdown" returnVariable="qRead">
<!DOCTYPE html>
<html lang="en-US">


Open in new window

function in CFC code
<cffunction name="Drawdown" 
		<!---<CFSET var qRead = "" />--->
		<cfstoredproc procedure="uspDrawdown" datasource="Inventory">

        <!---<cfprocresult name="qRead">--->
    	<!--- Return the query as a result to the caller --->
    	<!---<cfreturn qRead>--->

Open in new window

I have an intranet site running on server 2016 / IIS 10, just set it up.  It uses Windows Auth so I can tell which domain user is using the site (Coldfusion reads their windows username and matches it to a staff table).

There is a page where users fill out a time sheet.  When they submit the form, the browser (Chrome) shows "bad request".  I have the site emailing me when errors occur, and when that happens, I get an error about a form field being "undefined".  The strange thing is, when I submit that same form as myself, it work perfectly, no errors.  

So, I'm thinking that it has something to do with my account, being a domain admin, and that is somehow allowing me to POST data to the server?  Does that make any sense?  All other pages work normally, it's just this one that only I can submit successfully.

I'm at a loss as to where to begin troubleshooting
I have a webpage with a Coldfusion / HTML form that is similar to a spreadsheet.  Users can add lines to the form via Javascript or re-sort it with the jquery sortable plugin.  Lately some users have made this form very big and then failed to hit the big save button at the bottom of the page.  They want me to make it automatically save like excel.

Is there a way to have it silently submit the form in the background occasionally?  Would it be better to try and send one field at a time to update when a field loses focus?  I have a lot of small features I have added to it over the years, so I would rather not throw out the whole thing, but maybe that's what I need to do.
Exploring SQL Server 2016: Fundamentals
LVL 13
Exploring SQL Server 2016: Fundamentals

Learn the fundamentals of Microsoft SQL Server, a relational database management system that stores and retrieves data when requested by other software applications.

Tried to install ColdFusion 11 on Server 2016.  The installer finished sucessfully, but when trying to open the CFadmin page, I get error 404.   Looking in IIS manager, it doesn't look like the installer created the default website like it usually does...what do I do?
I'm doing an ajax call to a ColdFusion function to return a query. It should return a single record with three columns for an event's title, description, and date. I want to place each of those three pieces in their corresponding divs. Everything is working fine but I can't figure out how to access the results, and the options I've Googled up have failed me. How do I get the JSON equivalent of CF's queryName.columnName? Thanks!

The jQuery I'm using is as follows:
		 var id =;
		 var splitid = id.split('_');
		 var eventID = splitid[1];
		 // AJAX request
			type: "POST",
			url: "/cfc/calendar.cfc?method=getEventAjax",
		  dataType: "json",
			data: {
			 returnFormat: "json",
			 eventID: eventID
			success: function(response){ 
				// Add response in Modal body
				$('#eventTitle').html(what goes here for the title?);
				$('#eventDescription').html(what goes here for the description?);
				$('#eventDate').html(what goes here for the date, and what about formatting?);
				// Display Modal
			error: function (response) {
        $("#modal-body").html("This event could not be loaded.");

Open in new window

The function is simple:
<cffunction name="getEventAjax" access="remote" returntype="query" hint="returns info for single event">
		<cfargument name="eventID" type="numeric" required="yes">
		<cfquery name="qGetEvent" datasource="#APPLICATION.ds#">
			SELECT eventTitle, eventDescription, eventDate FROM calendar
			WHERE ID = <cfqueryparam value="#ARGUMENTS.eventID#" cfsqltype="CF_SQL_INTEGER">
		<cfreturn qGetEvent>

Open in new window

In the console log I'm getting
{COLUMNS(3), DATA: Array(1)},
DATA: Array(1)
0: Array(3)
0: "Radio Interview with Lucy Ann Lance of 1290AM"
1: "<p>Interview will take place at 8:20am EST</p>"
2: "July, 29 2019 00:00:00"
I have a PDF template. And I am using Coldfusion and database to get the data. Now i need to take that data and populate the PDF.  the data size is different so sometimes it is 1 page and sometimes 1+.

My template is only 1 page. How can I use the same template to say add another page
I'm trying to figure out how to access query data in a ColdFusion function. I have a query (qMyQuery) that's been returned from another function that will look something like this:

   | year   |  data
1  |  2014  |  1234
2  | 2015  |  2345
3  |  2016  |  3454

Open in new window

I'm sending it to a function that will figure out if the latest number is an increase or decrease and set the variables myQueryClass and myQueryDirectionText accordingly. This is what I'm sending:

<cfinvoke component="cfc.helpers" 
		variablePrefix = "myQuery"

Open in new window

And here is the function:
	<cffunction name="setCSS" access="public" returntype="array">
		<cfargument name="forQuery" type="string" required="yes" hint="the name of the query for which to set the css">
		<cfargument name="queryData" type="query" required="yes" hint="the query content">
		<cfargument name="upIsGood" type="boolean" required="yes" default="TRUE" hint="is an increase a good thing">
		<cfargument name="variablePrefix" type="string" required="yes" hint="what to preface the class/txt variables with">
		<cfargument name="directionTextUp" type="string" required="yes" default="Increasing" hint="the text for an increase in data">
		<cfargument name="directionTextDown" type="string" required="yes" default="Decreasing" hint="the text for an decrease in data">

Open in new window

Formatting SQL

i had this code

<cfset _top = 'USE [#ucase(dsn)#]#chr(13)#BEGIN TRY#chr(13)##chr(9)#BEGIN TRAN#chr(13)#'>
         <cfset _bottom = '#chr(9)#COMMIT TRAN#chr(13)#END TRY#chr(13)#BEGIN CATCH#chr(13)##chr(9)#ROLLBACK TRAN#chr(13)##chr(9)#SELECT Error_number ()    AS ErrorNumber,#chr(13)##chr(9)#Error_severity ()  AS ErrorSeverity,#chr(13)##chr(9)#Error_state ()     AS ErrorState,#chr(13)# #chr(9)#Error_procedure () AS ErrorProcedure,#chr(13)##chr(9)#Error_line ()      AS ErrorLine,#chr(13)##chr(9)#Error_message ()   AS ErrorMessage;#chr(13)#END CATCH#chr(13)##chr(13)##chr(10)#/*#chr(13)##chr(10)#Description: Create DML for  #table# table#chr(13)##chr(10)#Created by: me #chr(13)##chr(10)#Created: #dateformat(now(),'mm/dd/yyyy')##chr(13)##chr(10)#Last changed: #dateformat(now(),'mm/dd/yyyy')##chr(13)##chr(10)#*/'>     <cfset insertFINAL = '#_top##chr(13)##trim(createUpdateStatement)##chr(13)##_bottom#'>

Open in new window

the problem is thi is not display properly in the window as a very good formatted way, everything is coming in a single line

please guide what can be fixed here


if you ask for createUpdateStatement - this is just an update statement coming from a table which just written within the cfoutput tags , no chr being used for this
I am trying to place charts in tooltips using google charts. And got stock . Placing charts in the tooltip from this page

I am using this example but but instead of showing linear graph I need to to show a bar graph. The original graph is the linear graph

Thank you

	google.charts.load('current', {'packages':['corechart']});
	var primaryData = [
		<cfoutput query="qGetClassesPerMonth">
			["#sYearFull#", '#sessionKey#']	,
      var tooltipData = [
        <cfoutput query="qGetClassesPerMonthPerToolTip">
        	['#sessionkey#','#zipcode#','#zCnt#']	,
        var tooltipOptions = {
        title: 'U.S. Viewership Over The Last 10 Years (in millions)',
        legend: 'none'
      function drawTooltipCharts() {

        var data = new google.visualization.arrayToDataTable(tooltipData);
        var view = new google.visualization.DataView(data);

        // For each row of primary data, draw a chart of its tooltip data.
        for (var i = 0; i < primaryData.length; i++) {

          // Set the view for each event's data
          view.setColumns([0, i+1]);

          var hiddenDiv = 

Open in new window

I have a search cfm form that passes user inputs to another form. Call it test.cfm. It takes the inputs and passes to cfc to return a query results. works fine. problem is I have a create excel button that is supposed to open excel with the results. It opens but with no results. this is done on the posting of the same test.cfm form so looks like I lose my form variables from the search file. So how do I either save those values when posting same page or store the query results? Session variable? not sure how to do that.
Trying to learn ColdFusion.
I have a search page for user input that opens another page for viewing. That Page (call it test.cfm), is supposed to display the query results and display a button to export to excel. IF I use an cfinvoke to a component where I run the query and return it works. But trying to do that portion with an include to a javascript page using ajax and json to return the query. But never done this before and can't figure it out. Does anyone have a example how to do this?
I've attached my cfm and cfc page. I stripped out code to make it more simple to review. didn't include the javascript page because it's all wrong.
Good Morning Dear Expert,

I'm actually using Cfswitch expression to play several module on the same page with a page's "refreshment" when i submit the form.. i would like to use Coldfusion and Ajax for a different experience.. Is it possible on a input or submit Click, to call an Ajax function on the same page and in this function, change the variable of the CFcase expression to play a different mudule ?

Any response will be helpful..
HTML5 and CSS3 Fundamentals
LVL 13
HTML5 and CSS3 Fundamentals

Build a website from the ground up by first learning the fundamentals of HTML5 and CSS3, the two popular programming languages used to present content online. HTML deals with fonts, colors, graphics, and hyperlinks, while CSS describes how HTML elements are to be displayed.

Can a query result in ColdFusion be exported to a docx file? I see examples using cfspreadsheet to export to excel but not for word. Ideally I would open a word template and select a bookmark and export results to that location.

Anyone have an example?

I'm new to ColdFusion so trying to learn what I can do. Using ColdFusion 2016 with ColdFusion Builder.
Dear experts,

I have an input Text that get a javascript value but when i try to get it with coldfusion, i have an error; Coldfusion cannot convert this form value to a number..

Here i get the javascript value:

<input type="text" class="control" id="imgplace" >

Open in new window

But i cannot use it in this coldfusion fonction:

<cfset ImagePaste(imgc, area, 0, #form.imgplace#)>

Open in new window

is there a way to get this form value in coldfusion ?
I have a website written using Coldfusion. It is a dynamic website getting its content from a MySQL database

I am evaluating some tools that require connecting via an API. The type recommended is OUAUTH2 but other types are supported as well. I have never done anything like this before. Can anyone provide any information regarding how I would create an OUAUTH2 API.

Thank you for any help that you can provide
We are consuming some data from one of our vendors that gets returned in XML.  Some of the nodes have a dash ("-") in it - member-list.  I am just trying to loop through the results to update a table

<cfloop from="1" to="#arraylen(mydoc.member-list.membership.XmlChildren)#" index="i" step="1">

Open in new window

but coldfusion doesn't like the dash.  I have tried mydoc.["member-list"].membership.XmlChildren but that doesn't work either.We are running CF2016.
error code ... according to the tutorial everything is correct I can't find the error ( ... can anyone help first time using cold fusion
The <cfloop> tag requires an end tag to nest within <cfquery>, which began on line 12, column 2.
The CFML compiler was processing:

The body of a cfquery tag beginning on line 12, column 2.
The body of a cfquery tag beginning on line 12, column 2.
The error occurred in D:/home/ line 17
15 :  values gps_id,unit_assigned,event,date,crew_one,crew_two
16 : 
17 : <cfloop from="1" to="#arraylen(users)#" index="u"> 
18 :  <cfif u NEQ 1>,</cfif>
19 :  (

Open in new window

Action page
<cfset gps_id = FORM["GPS_ID[]"]>
<cfset  unit_assigned = FORM["Unit_assigned[]"]>
<cfset event = FORM["event[]"]>
<cfset date = FORM["Date[]"]>
<cfset gps_id = FORM["GPS_ID[]"]>
<cfset crew_one = FORM["crew_one[]"]>
<cfset crew_two = FORM["crew_two[]"]>
<cfset comments = FORM["comments[]"]>

<cfquery datasource="xxxxxx " name="insert_gps_data">
 insert into gpstable  (GPS_ID,Unit_asssign, event, Date, crew_one,crew_two)
 values gps_id,unit_assigned,event,date,crew_one,crew_two

<cfloop from="1" to="#arraylen(users)#" index="u"> 
 <cfif u NEQ 1>,</cfif>
 <cfqueryparam cfsqltype="cf_sql_varchar" value="#insert_gps_data[u].GPS_ID#">,
 <cfqueryparam cfsqltype="cf_sql_varchar" value="#insert_gps_data[u].Unit_assigned#">,
 <cfqueryparam cfsqltype="cf_sql_varchar" value="#insert_gps_data[u].event#">,
 <cfqueryparam cfsqltype="cf_sql_varchar" value="#insert_gps_data[u].Date#">,
 <cfqueryparam cfsqltype="cf_sql_varchar" value="#insert_gps_data[u].crew_one#">,
 <cfqueryparam cfsqltype="cf_sql_varchar" value="#insert_gps_data[u].crew_twot#">

Open in new window

var ct = 1;
function new_link()
	var div1 = document.createElement('div'); = ct;
	// link to delete extended form elements
	var delLink = '<div style="text-align:right;margin-right:65px"><a href="javascript:delIt('+ ct +')">Del</a></div>';
	div1.innerHTML = document.getElementById('newauth').innerHTML + delLink;
// function to delete the newly added set of elements
function delIt(eleId)
	d = document;
	var ele = d.getElementById(eleId);
	var parentEle = d.getElementById('newlink');

   #newlink {width:600px}
<form method="post" action="Action_page.cfm">
<div id="newlink">
<table border=0>
		<td> GPS ID: </td>
			<input type="text" name="GPS_ID[]" value="" validate='YES'>GPS ID <font size = -1 color = red>Required</font> 
			<input type="Text" name="Unit_assigned[]" value="noauth" validate="YES">Unit Assigned<font size = -1 color = red>Required</font> 
			<input type="text" name="event[]" value=<cfoutput>#form.Event_Name#</cfoutput> validate="YES">Event<font size = -1 color = red>Required</font>  
			<input type="Text" name="Date[]" value=<cfoutput>#form.Date#></cfoutput><font size = -1 color = red>Required</font> 
			<input type="text" name="event[]" value="" validate="YES">Crew Member 1<font size = -1 color = red>Required</font> 
			<input type="text" 

Open in new window


ColdFusion Language





ColdFusion is a server-side rapid application development platform originally created by Allaire and now sold by Adobe, implementing the dynamic general purpose CFML programming language. The term ColdFusion is sometimes colloquially used to refer to the CFML language (Cold Fusion Markup Language), but can also include discussions of the server software implementation. ColdFusion runs using a customised version of Apache Tomcat. Earlier versions are bundled with JRun.

Top Experts In
ColdFusion Language