4 Replies Latest reply on Apr 14, 2007 6:34 AM by BKBK

    StructKeyExists and 2 arrays

      I am working with an XML object with many optional elements. I am trying to use StructKeyExists to see if optional elements are indeed populated, but I can't figure out how to code the statement. Right now, I have given up and used the <cftry> option as shown below and it is working fine, but I understand that the StructKeyExists is more efficient.

      This is working...
      <cfset varCompanyName = xmlQuoteIn.Quotes.Quote[x].Policies.Policy[y].Company.Name.XmlText>
      <cfcatch type="any"><cfset varCompanyName=""></cfcatch>

      My attempt at using StructKeyExists looks like this (but it doesn't work)...
      <cfif StructKeyExists(xmlQuoteIn.Quotes.Quote[x].Policies.Policy[y],"Company.Name")>

      Is there a way to make the above "StructKeyExists" statement work?

      Thank you,
      David Josephs