ladybugz46
Technical User
Hi, I am admittedly new to vbscript. When posted to our site the following script appears to be reading the variables correctly but is calculating the percentages wrong. I am really hoping someone can help me with what is wrong. Thanks!!! suez
Note that this is only a sample of the array used and there is actually 260 items in the array.
Note that itempri and sku are available in the base page and the array and this code are written into that page as a file include.
Thanks!!! I sincerely appreciate all help. SueZ
Dim outletPrice(259,2)
outletPrice(0,0) = "515304GS"
outletPrice(0,1) = "45"
outletPrice(1,0) = "513864JW"
outletPrice(1,1) = "8.96"
outletPrice(2,0) = "514471JW"
outletPrice(2,1) = "13.1"
outletPrice(3,0) = "51FJ1483"
outletPrice(3,1) = "24.86"
outletPrice(4,0) = "51FJ1486"
outletPrice(4,1) = "25.79"
outletPrice(5,0) = "51FJ1484"
outletPrice(5,1) = "35.14"
outletPrice(6,0) = "513855JW"
outletPrice(6,1) = "2.88"
outletPrice(7,0) = "513713JW"
outletPrice(7,1) = "5.06"
outletPrice(8,0) = "512225JW"
outletPrice(8,1) = "3.63"
outletPrice(9,0) = "512226JW"
outletPrice(9,1) = "3.63"
'origPrice is what is uploaded to macs
'outletPrice is what is in the array (given to us by merchandising)
'savings is highest price minus what is uploaded to Macs
Dim sku
sku = Cstr(itno)
Dim origPrice
origPrice = itmpri
Dim savings
savings = outletPrice(i,1) - origPrice
For i = LBound(outletPrice) to UBound(outletPrice)
if outletPrice(i,0) = sku Then
response.write("<b>Save Over</b> " & FormatPercent((savings / outletPrice(i,1)), 0) & "<br>"
response.write("Retail Price: " & FormatCurrency(outletPrice(i,1)) & "<BR><br>"
response.write("Now Only: " & FormatCurrency(origPrice) & "<BR>"
Else
end if
next
Note that this is only a sample of the array used and there is actually 260 items in the array.
Note that itempri and sku are available in the base page and the array and this code are written into that page as a file include.
Thanks!!! I sincerely appreciate all help. SueZ
Dim outletPrice(259,2)
outletPrice(0,0) = "515304GS"
outletPrice(0,1) = "45"
outletPrice(1,0) = "513864JW"
outletPrice(1,1) = "8.96"
outletPrice(2,0) = "514471JW"
outletPrice(2,1) = "13.1"
outletPrice(3,0) = "51FJ1483"
outletPrice(3,1) = "24.86"
outletPrice(4,0) = "51FJ1486"
outletPrice(4,1) = "25.79"
outletPrice(5,0) = "51FJ1484"
outletPrice(5,1) = "35.14"
outletPrice(6,0) = "513855JW"
outletPrice(6,1) = "2.88"
outletPrice(7,0) = "513713JW"
outletPrice(7,1) = "5.06"
outletPrice(8,0) = "512225JW"
outletPrice(8,1) = "3.63"
outletPrice(9,0) = "512226JW"
outletPrice(9,1) = "3.63"
'origPrice is what is uploaded to macs
'outletPrice is what is in the array (given to us by merchandising)
'savings is highest price minus what is uploaded to Macs
Dim sku
sku = Cstr(itno)
Dim origPrice
origPrice = itmpri
Dim savings
savings = outletPrice(i,1) - origPrice
For i = LBound(outletPrice) to UBound(outletPrice)
if outletPrice(i,0) = sku Then
response.write("<b>Save Over</b> " & FormatPercent((savings / outletPrice(i,1)), 0) & "<br>"
response.write("Retail Price: " & FormatCurrency(outletPrice(i,1)) & "<BR><br>"
response.write("Now Only: " & FormatCurrency(origPrice) & "<BR>"
Else
end if
next