Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

check to see if value exists in structure

Status
Not open for further replies.

blues77

Programmer
Joined
Jun 11, 2002
Messages
230
Location
CA
Hello,

I would like to know if there is any function available in Coldfusion that will allow me to tet to see if a Key exists in a structure or not. Any and all help is appreciated.

Thanks
Mike
 
Ok I think I figured this one out. I'm using the function StructKeyExists. However now I'm having a little trouble in my utilization of this function. I'm trying to use it to check and see if a 2 deminsional key exists but I'm getting a "Expression Error". Here is the code that appears to be generating the error

Code:
<CFIF StructKeyExists(Variables.clerkData, [totals_query.ClerkID]["Refunds"])>

What I'm trying to do here is check to see if the key composed of the ClerkID and the string "Refunds" exists. Can anyone tell me how I could accomplish this? All help is appreciated.

 
well, you have your syntax structure WAY off.
livedocs said:
StructKeyExists(structure, "key")

what does your struct look like, since your syntax is off, i'm having an hard time seeing what you're after

We've heard that a million monkeys at a million keyboards could produce the complete works of Shakespeare; now, thanks to the Internet, we know that is not true.
 
I actually figured it out I needed to write it like
Code:
StructKeyExists(Variables.clerkData[totals_query.ClerkID],"Refunds")
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top