Mar
26
2009
Error Building Struct with CreateUUID
This is more for myself than anyone else, but I hit an odd snag in ColdFusion this morning. I got an error when trying to create a new structure member using a CreateUUID() function and ColdFusion's shorthand structure notation. The following code fails:
<cfset "foo"}="" =="" currentorder.cart[createuuid()]="{type">
The error I receive is that "Element 435A2A8C-0B35-C81F-4F36BE50E1B8F394 is undefined in a CFML structure referenced as part of an expression." Well duh! I'm trying to create it!
So I changed the code to this, which works perfectly:
Does anyone have any idea why using the CreateUUID() function directly in the assignment statement would cause a problem?