Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

need help with calculation...

Status
Not open for further replies.

phreakgrrrl

Technical User
Jan 30, 2003
26
US
ok...so im a newbie and dont know if im gonna explain this right so...well ok here it is...

<%
subtotal = 0
tempunitprice = CDbl(rsAddItem(&quot;unitprice&quot;))
subtotal = rsAddItem(&quot;quantity&quot;) * tempunitprice
if CDbl(subshipping) > CDbl(totalshipping) then
totalshipping = subshipping
total = total + subtotal
end if %>

thats the calc i have....

the shipping cost and total costs are not being calculated at all..
any ideas anyone??
 
step through it and make sure that CDbl(subshipping) > CDbl(totalshipping) is true.
 
so i tried to start from sratch....it now reads...
<%
subtotal = 0
tempunitprice = CDbl(rsAddItem(&quot;unitprice&quot;))
subtotal = rsAddItem(&quot;quantity&quot;) * tempunitprice
totalshipping = rsAddItem(&quot;shippingprice&quot;)
total = total + subtotal
%>

still zilch...but at least now you can read the total price...before it wouoldnt even give me that...


i feel like im missing something big here...
(help)
 
Do you have an OPTION EXPLICIT at the top of the page.
Where is Total defined and what is the point of
totalshipping = rsAddItem(&quot;shippingprice&quot;)
if totalshipping is not used.? Forms/Controls Resizing/Tabbing Control
Compare Code (Text)
Generate Sort Class in VB or VBScript
 
ok...it might help if you see what page im talking about...



just add any item to the cart and youll see what i mean...

cause i really think im not explaining this right...

if you could please help me make sence out of this i would really appreciate it

thank you
 
ok....sorry...im working witha friday afternoon brain.

so i figured out what i had to do to make this thing work right...which is a shoppiong cart btw...

now to pose a question that HAS an answer...
i need to , if there is more than one item, void all but the highest shipping cost.
example...
if someone orders th ree items
and they all have different shipping values...
i want the total shipping cost to be ONLY hte highest of the three.

i knwo this has to be a simple if then else but ...
being as ive never worked with this stuff before...i could use some advise..

thanks for reading me rambling :)

 
if then else coooooould work... I would suggest doing it like this... and this is all pseudo code sinc eI don't know your specifics... please don't try to implement verbatim

set shippingcost = 0
loop through your recordset
shippingcost = max(shippingcost,shippingcost in this recordset)
end loop

and when your done, shippingcost is set to the highest value... I'm fairly certain vb has a max function built in somewhere, but if you can't find it you can always say

if (shippingcost > shippingcostinrecordset)
shippingcost = shippingcost
else
shippingcost = shippingcostinrecordset
end if

 
um....im gonna try that ...but again....iknow not what i;m doing here so....im prolly gonna be posting back with more q's...

:
 
ok.....so as expected i had no clue how to set that up. could you elaborate?


*blush*
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top