I'm running a specific query against the Amazon API/AWS.

The problem is, certain of my attributes seem to be overwritten by the last 
result of the query set, and I don't understand why.

Here's my script (with some variables removed for brevity):

<cfscript>
AmazonXML = XmlParse(cfhttp.filecontent);
BookList = ArrayNew(1);
Book = StructNew();
    i=1;
     while (i LTE 10)
     {
                Book.ASIN = 
AmazonXML.ItemSearchResponse.Items.Item[i].ASIN.XmlText;
                Book.SalesRank = 
AmazonXML.ItemSearchResponse.Items.Item[i].SalesRank.XmlText;
                Book.Title = 
AmazonXML.ItemSearchResponse.Items.Item[i].ItemAttributes.Title.XmlText;
                                
                AddBook = ArrayAppend(BookList,Book);
                
        i=i+1;
                
     }

</cfscript>

Here's the output:

<cfloop index="BookOutput" from="1" to="#ArrayLen(BookList)#">
<cfoutput>



Title: #BookList[BookOutput].Title#<br>
Sales Rank: #BookList[BookOutput].SalesRank#<br>
ASIN: #BookList[BookOutput].ASIN#<br>

<br>
<br>
</cfoutput>
</cfloop>

Title comes out as unique for all 10 results, but SalesRank and ASIN display 
the values of the last items in the results set.

I don't see why that would be.

H.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:244882
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to