• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

ISDefined Problems with Arrays from XML

Guest
Jun 27, 2007 Jun 27, 2007

Copy link to clipboard

Copied

I am using MX7 to XMLParse and then XMLSearch tp finf variables from Flight Operators. Sadly, not every operator provides consistent XML Structures, and so certain fields are missing without any idea which are missing. If I attempt to use <cfif IsDefined to block out missing fields as below:-

<cfif IsDefined("Options_Array.XmlAttributes.UnitCost")>

I get the Error Message - Parameter 1 of function IsDefined, which is now "Options_Array.XmlAttributes.UnitCost", must be a syntactically valid variable name.

How do I get around that?

Thanks for any help.
TOPICS
Advanced techniques

Views

320

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Contributor , Jun 27, 2007 Jun 27, 2007
In this case, instead of IsDefined() you want to use StructKeyExists().

Something like:
CFIF StructKeyExists(Options_Array.XmlAttributes, "UnitCost")

Votes

Translate

Translate
Contributor ,
Jun 27, 2007 Jun 27, 2007

Copy link to clipboard

Copied

In this case, instead of IsDefined() you want to use StructKeyExists().

Something like:
CFIF StructKeyExists(Options_Array.XmlAttributes, "UnitCost")

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 27, 2007 Jun 27, 2007

Copy link to clipboard

Copied

LATEST
> CFIF StructKeyExists(Options_Array.XmlAttributes, "UnitCost")

I wonder is whether it should be Options_Array .XmlAttributes, where i is
the relevant index of the array..? I'm guessing it's the result of your
xmlSearch()?

--
Adam

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation