Kind Regards
Claude
Raiola (Director)
AustralianAccommodation.com Pty. Ltd.
Mobile: 0414 228
948
Fax: 07 3319 6444
Websites:
www.AustralianAccommodation.com
www.AccommodationNewZealand.com
www.HospitalityPurchasing.net
--------Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]On Behalf Of Stephen Milligan
Sent: Saturday, 31 January 2004 10:33 AM
To: CFAussie Mailing List
Subject: [cfaussie] RE: How To Determining if specific Variable Arrays existNot forgetting of course to replace the *ahem* deliberate line with the re-declared local variable just after the opening <cftry> tag with this:<cfset tmp = arguments.array[arguments.element]>Spike
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Stephen Milligan
Sent: Friday, January 30, 2004 4:18 PM
To: CFAussie Mailing List
Subject: [cfaussie] RE: How To Determining if specific Variable Arrays existThe only reliable way to test if an array element exists is to put a try/catch block around it:<cffunction name="isArrayElementDefined"><cfargument name="array" type="array" required="true"><cfargument name="element" type="numeric" required="true"><cfset var tmp = ""><cftry><cfset var tmp = arguments.array[arguments.element]><cfcatch><cfreturn false></cfcatch></cftry><cfreturn true></cffunction><cfset myArray = arrayNew(1)><cfset myArray[1] = "foo"><cfset myArray[4] = "bar"><cfoutput><cfloop from="1" to="#arrayLen(myArray)#" index="i"><br><br><cfif isArrayElementDefined(myArray,i)>Element #i# exists.<cfelse>Element #i# does not exist.</cfif></cfloop></cfoutput>Spike
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Claude Raiola
Sent: Friday, January 30, 2004 4:06 PM
To: CFAussie Mailing List
Subject: [cfaussie] RE: How To Determining if specific Variable Arrays existwhen I use the arraylen() function eg:<cfif ArrayLen(aTDWDoc.atdw_data_results.product_distribution.product_record.max_star_rating.XmlText) LTE i>generates the following error message(I need to include "product_record.max_star_rating" ) as that is the specific array element I am testing for to see whether it exists hence the reason for initially trying to use isdefined() functionObject of type class java.lang.String cannot be used as an array
The error occurred in D:\inetpub\webhost\4301\www\aus\ATDW\query_products_26_01_04.cfm: line 60 58 : <cfset prodn = QuerySetCell(myquery, "product_description", aTDWDoc.atdw_data_results.product_distribution[i].product_record.product_description.XmlText, i)> 59 : </cfif> 60 : <cfif ArrayLen(aTDWDoc.atdw_data_results.product_distribution.product_record.max_star_rating.XmlText) LTE i> 61 : <cfset prodn = QuerySetCell(myquery, "star_rating", aTDWDoc.atdw_data_results.product_distribution[i].product_record.max_star_rating.XmlText, i)> 62 : </cfif>
Kind Regards
Claude Raiola (Director)
AustralianAccommodation.com Pty. Ltd.
Mobile: 0414 228 948
Fax: 07 3319 6444
Websites:
www.AustralianAccommodation.com
www.AccommodationNewZealand.com
www.HospitalityPurchasing.net--------Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]On Behalf Of Steve Onnis
Sent: Saturday, 31 January 2004 7:50 AM
To: CFAussie Mailing List
Subject: [cfaussie] RE: How To Determining if specific Variable Arrays existYou cant use isDefined() for arraysYou could try using ArrayLenso<cfif ArrayLen(aTDWDoc.atdw_data_results.product_distribution) LTE i><cfset prodn = QuerySetCell(myquery, "star_rating", aTDWDoc.atdw_data_results.product_distribution[i].product_record.max_star_rating.XmlText, i)></cfif>
That might do youSteve-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]On Behalf Of Claude Raiola
Sent: Saturday, 31 January 2004 4:47 AM
To: CFAussie Mailing List
Subject: [cfaussie] How To Determining if specific Variable Arrays exist---I am trying to use the isdefined function to determine with a variable within an array exists. The code is in bedded within the cfloop with index=Iwhen using the syntax in line 60 below the following error message occurswondering what is the correct syntax in order to be able to determine whether specific variables within the are defined.I look forward to your input
Parameter 1 of function IsDefined, which is now "aTDWDoc.atdw_data_results.product_distribution[i].product_record.max_star_rating.XmlText", must be a syntactically valid variable name.
The error occurred in D:\inetpub\webhost\4301\www\aus\ATDW\query_products_26_01_04.cfm: line 60 60 : <cfif isdefined('aTDWDoc.atdw_data_results.product_distribution[i].product_record.max_star_rating.XmlText')> 61 : <cfset prodn = QuerySetCell(myquery, "star_rating", aTDWDoc.atdw_data_results.product_distribution[i].product_record.max_star_rating.XmlText, i)> 62 : </cfif>
Kind Regards
Claude Raiola (Director)
AustralianAccommodation.com Pty. Ltd.
Mobile: 0414 228 948
Fax: 07 3319 6444
Websites:
www.AustralianAccommodation.com
www.AccommodationNewZealand.com
www.HospitalityPurchasing.net---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]
MXDU2004 + Macromedia DevCon AsiaPac + Sydney, Australia
http://www.mxdu.com/ + 24-25 February, 2004
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]
MXDU2004 + Macromedia DevCon AsiaPac + Sydney, Australia
http://www.mxdu.com/ + 24-25 February, 2004
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]
MXDU2004 + Macromedia DevCon AsiaPac + Sydney, Australia
http://www.mxdu.com/ + 24-25 February, 2004 ---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]
MXDU2004 + Macromedia DevCon AsiaPac + Sydney, Australia
http://www.mxdu.com/ + 24-25 February, 2004 ---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]
MXDU2004 + Macromedia DevCon AsiaPac + Sydney, Australia
http://www.mxdu.com/ + 24-25 February, 2004
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]
MXDU2004 + Macromedia DevCon AsiaPac + Sydney, Australia
http://www.mxdu.com/ + 24-25 February, 2004
