freelanceprogrammers.org Forum Index » Cold Fusion

Looping/Array Problem driving me crazy..please help!


View user's profile Post To page top
bushleaguer77 Posted: Thu Jul 28, 2005 11:19 pm


Joined: 07 Jul 2005

Posts: 3
Looping/Array Problem driving me crazy..please help!
Hey guys,

I have a problem with a UPS XML get Rates script. It works when I
use a zip code that starts with any number other than "0" for the
most part. How do I get the Array to use the 0? Here is the error
code it throws:

TNTData.TimeInTransitResponse.TransitResponse.ServiceSummary doesn`t
exist.

Here is my code:

<?xml version="1.0"?>
<TimeInTransitRequest xml:lang="en-US">
<Request>
<TransactionReference>
<XpciVersion>1.0002</XpciVersion>
</TransactionReference>
<RequestAction>TimeInTransit</RequestAction>
</Request>
<TransitFrom>
<AddressArtifactFormat>
<CountryCode>US</CountryCode>

<PostcodePrimaryLow>01581</PostcodePrimaryLow>
</AddressArtifactFormat>
</TransitFrom>
<TransitTo>
<AddressArtifactFormat>
<CountryCode>US</CountryCode>

<PostcodePrimaryLow>#zip#</PostcodePrimaryLow>

<ResidentialAddressIndicator>1</ResidentialAddressIndicator>
</AddressArtifactFormat>
</TransitTo>
<PickupDate>#DateFormat(shipdate,`YYYYMMDD`)
#</PickupDate>
</TimeInTransitRequest></cfoutput>
</cfsavecontent>
<cfhttp url="https://www.ups.com/ups.app/xml/TimeInTransit"
port="443" method="POST" throwonerror="yes">
<cfhttpparam name="requestTNT" type="XML" value="#TNT#">
</cfhttp>
<cfset TNTData = XmlParse(CFHTTP.FileContent)>
<cfloop from="1" to="#ArrayLen
(TNTData.TimeInTransitResponse.TransitResponse.ServiceSummary)#"
index="i">
<cfset services[i]=structnew()>
<cfset services
[i].code=TNTData.TimeInTransitResponse.TransitResponse.ServiceSummary
[i].Service.Code.xmlText>
<cfset services
[i].type=TNTData.TimeInTransitResponse.TransitResponse.ServiceSummary
[i].Service.Description.xmlText>
<cfset services
[i].tt=TNTData.TimeInTransitResponse.TransitResponse.ServiceSummary
[i].EstimatedArrival.BusinessTransitDays.xmlText>
<cfset services
[i].arrivaldate=TNTData.TimeInTransitResponse.TransitResponse.Service
Summary[i].EstimatedArrival.Date.xmlText>
<cfset services
[i].arrivaltime=TNTData.TimeInTransitResponse.TransitResponse.Service
Summary[i].EstimatedArrival.Time.xmlText>
</cfloop>

Any ideas on how to get around this problem? Thanks I have been
trying to figure this out for the past 2 days!!

-Chris
Reply with quote
Send private message
Post new topic Reply to topic
Display posts from previous:   
 

All times are GMT
Page 1 of 1
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Freelace Website Designer - Customer web design and software building.
Booking Calendar - reservation calendar script
Land Surveying - total station instruments and equipments
China Wholesale - Electronics Products
Character Studio - Tutorials and Help