Output loop data to a string
I have an application which connnects to FexEx freight and gets a quote based on the products in the shopping cart. In order to get a quote from Fedex you need to pass a string to their application. I am looking to dynamically generate the weight and shipping class for each product (as_class & as_weight).
Sample from FedEx:
"http://www.fedexfreight.fedex.com/XMLRating.jsp?as_shipterms=prepaid&as_shzip=85748& as_shcntry=US&as_cnzip=80112&as_cncntry=US& ***** as_class1=070&as_weight1=480&as_class2=050&as_weig ht2=100 ***** &as_acctnbr=XXXXXXXX&as_iamthe=shipper", False
***** This is the string I need to build based on the products in the shopping cart. *****
The code below outputs the correct string but I don't know how to capture it.
shippingArray = objRS.GetRows()
Const totalWeight = 0
Const shippingClass = 1
For lnLoopCounter = 0 To Ubound(shippingArray,2)
Response.Write "as_class" & lnLoopCounter + 1 & "=" & shippingArray(shippingClass, lnLoopCounter) _
& "&as_weight" & lnLoopCounter + 1 & "=" & shippingArray(totalWeight, lnLoopCounter) _
& "&"
Next
Output:
as_class1=50&as_weight1=100&as_class2=50&as_weight 2=400&as_class3=50&as_weight3=900&
The above string is exactly what I need to capture. There are three products in the my shopping cart (1 - class 50/100lbs., 2 - class 50/400lbs., 3 - class 50,900lbs.)
However, this is what I tried but it only captures the last (Ubound) record.
shippingArray = objRS.GetRows()
Const totalWeight = 0
Const shippingClass = 1
For lnLoopCounter = 0 To Ubound(shippingArray,2)
shippingString = "as_class" & lnLoopCounter + 1 & "=" & shippingArray(shippingClass, lnLoopCounter) _
& "&as_weight" & lnLoopCounter + 1 & "=" & shippingArray(totalWeight, lnLoopCounter) _
& "&"
Next
Response.Write shippingString
%>
Output:
as_class3=50&as_weight3=900&
How do I capture the shippingString which is generated by looping thru the recordset?
|