Array Issue I Think?

Ask a Question related to Coldfusion - Advanced Techniques, Design and Development.

  1. #1

    Default Array Issue I Think?

    I am trying to return rates from the UPS site, and I got it working for the
    most part. However, if I have a zip code that starts with a 0 in it, I get an
    error:

    column 1
    detail Error at line 1, column 17
    errorcode [empty string]
    errorlogfile C:\BlueDragon_Server_62\.\work\temp\rtelogs\bderro r6448.html
    extendedinfo [empty string]
    line 42
    message TNTData.TimeInTransitResponse.TransitResponse.Serv iceSummary doesn't
    exist.
    scriptline 0
    tagcontext array
    1 struct
    column 1
    id CFLOOP
    line 42
    template C:/Inetpub/wwwroot/shipping/transite_work.cfm


    type Application


    How do I get my array loop to include the 0? Here is the code:

    <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.Transi tResponse.ServiceSummary)#"
    index="i">
    <cfset services=structnew()>
    <cfset
    services.code=TNTData.TimeInTransitResponse.Transi tResponse.ServiceSummary.Servi
    ce.Code.xmlText>
    <cfset
    services.type=TNTData.TimeInTransitResponse.Transi tResponse.ServiceSummary.Servi
    ce.Description.xmlText>
    <cfset
    services.tt=TNTData.TimeInTransitResponse.TransitR esponse.ServiceSummary.Estimat
    edArrival.BusinessTransitDays.xmlText>
    <cfset
    services.arrivaldate=TNTData.TimeInTransitResponse .TransitResponse.ServiceSummar
    y.EstimatedArrival.Date.xmlText>
    <cfset
    services.arrivaltime=TNTData.TimeInTransitResponse .TransitResponse.ServiceSummar
    y.EstimatedArrival.Time.xmlText>
    </cfloop>

    Any help with this would be great, thanks.

    Chris

    EnergyFed Guest

  2. Similar Questions and Discussions

    1. Issue with a mailer and a data array
      Hi there, I hope someone can help me with this, I am fairly new to PHP and am struggling to get a simple order form to send a mail message form...
    2. [newbie]saving and reading array of associative array
      i'm looking for examples of saving to file and reading back an array of associative array, in a ruby like way. saying i have something like : ...
    3. GD: Graph Data Array Issue
      Hi All. I'm relatively new to Perl, and have been somewhat successful using the GD::Graph and Graph3d modules. I'm using this procedure as a...
    4. array data matches but array created in loop doesn't work
      I have the exact same data in two arrays, but only the array created like so will work: $spaw_imglibs = array( array( 'value' =>...
    5. #24897 [Com]: array_multisort() will reindex the array but not if array length is 1
      ID: 24897 Comment by: franklin_se at hotmail dot com Reported By: chro at sokrates dot uio dot no Status: ...
  3. #2

    Default Re: Array Issue I Think?

    Never mind I got this to work, sort of! The only problem I am running into
    now, is that zip codes throw a lot of errors due to different city spellings
    and towns sharing zips. I added a city field and it works good like that.
    However, I wanted to make this as simple as possible and just use the zip
    code. Is there a way to maybe use a <cfif> if the form.city is blank? Or is
    there another way to insert the right info?
    Thanks,
    Chris

    EnergyFed Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139