Home Articles FAQs XREF Games Software Instant Books About Feedback Search Site-Map
irt.org logo

Q3019 Can I use the array functions with my ColdFusion recordset(query)?

irt.org | Knowledge Base | ColdFusion | Q3019 [ previous next ]

Q3019 Can I use the array functions with my ColdFusion recordset(query)?

Yes. All ColdFusion array functions are available for use with your recordsets. The only hitch is that you have to use array notation to address the column that you want to work on.

For example, with this code you can grab all of the records in a table and perform different sums on the columns. This way, you have the data you need to do all of your work in one query.

<cfquery name="GetSalesData" datasource="#DSN#" dbtype="ODBC" Username="#UserName#" Password="#Password#">
	SELECT SalesPerson, MonthlyLeads, MonthlySales
	FROM TotalSales
	WHERE Product = 'MondoWidget2000'
</cfquery>

<CFSet AllLeads = ArraySum(GetSalesData["MonthlyLeads"])>
<CFSet AllSales = ArraySum(GetSalesData["MonthlySales"])>

Submitted by Bill Sterzenbach


Provide feedback ...
AddThis Social Bookmark Button

Provide feedback ... AddThis Social Bookmark Button


Last Updated: 30th March 2008. Maintained by: Martin Webb
irt.org liability, trademark, document use, privacy statement and software licensing rules apply.
Copyright © 1996-2008 irt.org, All Rights Reserved.