As a follow up to my earlier post, another common 'gotcha' with ColdFusion Lists are empty list items. What's an empty list item? Consider this simple list of names:

<cfset names="Baltar,Apollo,Starbuck,,Bozo">

I think most people, including myself, would look at that and say that the list had 5 items, with the 4th item being a simple empty string. But ColdFusion simply ignores empty list items. If you perform a listLen() on that string, you get 4.

Now - we can argue about whether or not that makes sense. I'm not quite sure it does - but that's how ColdFusion handles it. If you want to handle this differently, you need to write your own code, or perhaps replace the empty items with a string that will represent 'null' for your application. Check out ListFix() at for a UDF that does this.

Thanks to Phillip Senn for reminding me of this - I actually forgot it during my presentation.

More Variable Type Gotchas tomorrow - after I arrive at cf.Objective!