Dominic, you are exactly correct. That IS my problem. I'll have to try
StructKeyExists. Thanks!

-----Original Message-----
From: Dominic Watson [mailto:[EMAIL PROTECTED] 
Sent: Thursday, November 15, 2007 10:53 AM
To: CF-Talk
Subject: Re: I really code use some Web Service/XML help.

Try and Catch will always work :) But if you want a different, 'more
elegent' solution...

Is the problem that some 'ProductInformation' elements do not contain all
the expected sub-elements? i.e. you are expecting:

productinfo[x].productid
productinfo[x].productLink
productinfo[x].productName

And sometimes you only get:

productinfo[x].productid
productinfo[x].productName

If so, I imagine you want to display a record even if it does not contain
all the correct fields and instead of try & catch you should be able to use
<cfif StructKeyExists(productinfo[x], 'productLink')>Show it</cfif>

But maybe I'm still getting the wrong end of the stick?

Regards,

Dominic


On 15/11/2007, Che Vilnonis <[EMAIL PROTECTED]> wrote:
>
> Dominic, I solved the problem with the cftry/cfcatch combo that Dave 
> suggested in a previous email.
>
> But in a nutshell, imagine this. You are looping through an array. You 
> expect that the array will have 5 elements of xml data because that 
> has been the case for the last 2 years. For whatever reason, now some 
> arrays only contain 4 elements. (Not 5 elements with one blank value.) 
> I was/am trying to figure out how to elegantly to display the data w/o 
> any errors when the missing element was cfoutput-ted.
>
> XMLSearch, isdefined, cfparam and ArrayIsDefined were not working (at 
> least for me).
>
> Thanks, Che


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
ColdFusion is delivering applications solutions at at top companies 
around the world in government.  Find out how and where now
http://www.adobe.com/cfusion/showcase/index.cfm?event=finder&productID=1522&loc=en_us

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:293415
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to