Category Archives: Snippets

quick code tips for single elements, attributes, or details

looping over Arrays

Yippee we can now easily loop over arrays in CF8. <cfloop array=”arrayname” index=”i”> <cfoutput>#i#</cfoutput> </cfloop> #i# will show us the values in the array. You can ofcourse apply logic to the output so that dates an numbers are formatted.

Posted in Code, Coldfusion, Snippets | Comments Off on looping over Arrays

CFMail Adding multiple attachments with CFMAILPARAM

In building a project for work I needed to add potentially multiple attachments to an email. Fortunately, CFMail has a way to add header and additional information. <cfmail to=”somebody@domain.com” from = “yourstruly@domain.com” subject=”something” server=”yourmailserver”> <p>Here are your attachments.</p> <cfmailparam file=”c://yourpath/filename.ext”> … Continue reading

Posted in Code, Coldfusion, Problems & Fixes, Snippets | Comments Off on CFMail Adding multiple attachments with CFMAILPARAM

ColdFusion ReReplace

Avery useful function for dealing with strings. Uses a regular expression (RE) to search a string for a string pattern and replace it with another. The search is case-sensitive, and it has attributes you can set to control case. REReplace(string, … Continue reading

Posted in Code, Coldfusion, Snippets | Comments Off on ColdFusion ReReplace

Using CF IIF with Javascript Functions

I get bored writing CFIF statements so thought I would try using the old IIF method. Despite the arguments about performance it works quite well if you are not running it through thousands of iterations. I also had need to … Continue reading

Posted in Code, Coldfusion, Snippets | Comments Off on Using CF IIF with Javascript Functions

Penny Rounding

Rounding issues are the bane of every accountants existence. While a few records may only produce a few cents difference a few million records can lead to thousands of dollars or just a penny. Depending on if the rounding occurs … Continue reading

Posted in Code, Snippets, SQL | Comments Off on Penny Rounding