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!

Extensive If..Then..statements..not working please help! 1

Status
Not open for further replies.

bikebanditcom

Programmer
Jun 11, 2003
117
US
below is a very extensive if...then statement i just finished, and it seems to be valid but i'm not getting any calculations, i'm writing every form field to the screen on my page that processes the form and inserts it into the database, the problem is the three fields that are in the calc are restockingFee, transAmount, and transType, those three are not being written to the screen meaning they aren't working. my code seems to be proper, can anyone help?

<%
If Complete = &quot;Yes&quot; Then
If california = &quot;Yes&quot; Then
If shipped = &quot; Yes&quot; Then
If restockingFee = &quot;Yes&quot; Then
If CrdtToBeIssd = &quot;Yes&quot; Then
'Condition One
restockingFee = mercValue * .2
transAmount = mercValue + addOrigShipping + addRtrnShipping + caSalesTax - restockingFee
transType = &quot;Enter Credit&quot;
ElseIf CrdtToBeIssd = &quot;No&quot; Then
'Condition Two - theroretically can't happen i think
restockingFee = 0
Cdbl(transAmount = mercValue + addOrigShipping + addRtrnShipping + caSalesTax)
transType = &quot;Enter Credit&quot;
End If
ElseIf restockingFee = &quot;No&quot; Then
If CrdtToBeIssd = &quot;Yes&quot; Then
'Condition Three - must be a bb error
restockingFee = 0
Cdbl(transAmount = mercValue + addOrigShipping + addRtrnShipping + caSalesTax)
transType = &quot;Enter Credit&quot;
ElseIf CrdtToBeIssd = &quot;No&quot; Then
'Condition Four - must be an exchange
restockingFee = 0
transAmount = 0
transType = &quot;No Transaction&quot;
End If
End If
ElseIf shipped = &quot;No&quot; Then
If restockingFee = &quot;Yes&quot; Then
If CrdtToBeIssd = &quot;Yes&quot; Then
'Condition Five - therorectially can't happen i think
restockingFee = 0
transAmount = 0
transType = &quot;No Transaction&quot;
ElseIf CrdtToBeIssd = &quot;No&quot; Then
'Condition Six
restockingFee = 0
Cdbl(transAmount = mercValue * -.2)
End If
ElseIf restockingFee = &quot;No&quot; Then
If CrdtToBeIssd = &quot;Yes&quot; Then
'Condition Seven - therorectially can't happen i think
restockingFee = 0
transAmount = 0
transType = &quot;No Transaction&quot;
ElseIf CrdtToBeIssd = &quot;No&quot; Then
'Condition Eight - could only be a cancel within 1 hr
restockingFee = 0
transAmount = 0
transType = &quot;No Transaction&quot;
End If
End If
End If
ElseIf california = &quot;No&quot; Then
If shipped = &quot; Yes&quot; Then
If restockingFee = &quot;Yes&quot; Then
If CrdtToBeIssd = &quot;Yes&quot; Then
'Condition Nine
CDbl(restockingFee = mercValue * .2)
CDbl(transAmount = mercValue + addOrigShipping + addRtrnShipping - restockingFee)
transType = &quot;Enter Credit&quot;
ElseIf CrdtToBeIssd = &quot;No&quot; Then
'Condition Ten - theroretically can't happen i think
restockingFee = 0
Cdbl(transAmount = mercValue + addOrigShipping + addRtrnShipping)
transType = &quot;Enter Credit&quot;
End If
ElseIf restockingFee = &quot;No&quot; Then
If CrdtToBeIssd = &quot;Yes&quot; Then
'Condition Eleven - must be a bb error
restockingFee = 0
Cdbl(transAmount = mercValue + addOrigShipping + addRtrnShipping)
transType = &quot;Enter Credit&quot;
ElseIf CrdtToBeIssd = &quot;No&quot; Then
'Condition Twelve - must be an exchange
restockingFee = 0
transAmount = 0
transType = &quot;No Transaction&quot;
End If
End If
ElseIf shipped = &quot;No&quot; Then
If restockingFee = &quot;Yes&quot; Then
If CrdtToBeIssd = &quot;Yes&quot; Then
'Condition Thirteen - therorectially can't happen i think
restockingFee = 0
transAmount = 0
transType = &quot;No Transaction&quot;
ElseIf CrdtToBeIssd = &quot;No&quot; Then
'Condition Fourteen
restockingFee = 0
Cdbl(transAmount = mercValue * -.2)
transType = &quot;Enter Charge&quot;
End If
ElseIf restockingFee = &quot;No&quot; Then
If CrdtToBeIssd = &quot;Yes&quot; Then
'Condition Fifteen - therorectially can't happen i think
restockingFee = 0
transAmount = 0
transType = &quot;No Transaction&quot;
ElseIf CrdtToBeIssd = &quot;No&quot; Then
'Condition Sixteen- could only be a cancel within 1 hr
restockingFee = 0
transAmount = 0
transType = &quot;No Transaction&quot;
End If
End If
End If
End If
ElseIf complete = &quot;No&quot; Then
If california = &quot;Yes&quot; Then
If shipped = &quot; Yes&quot; Then
If restockingFee = &quot;Yes&quot; Then
If CrdtToBeIssd = &quot;Yes&quot; Then
'Condition One
CDbl(restockingFee = mercValue * .2)
CDbl(transAmount = mercValue + addOrigShipping + addRtrnShipping + caSalesTax)
transType = &quot;Enter Credit&quot;
ElseIf CrdtToBeIssd = &quot;No&quot; Then
'Condition Two
CDbl(restockingFee = mercValue * .2)
CDbl(transAmount = mercValue + addOrigShipping + addRtrnShipping + caSalesTax - restockingFee)
transType = &quot;Enter Credit&quot;
End If
ElseIf restockingFee = &quot;No&quot; Then
If CrdtToBeIssd = &quot;Yes&quot; Then
'Condition Three
restockingFee = 0
CDbl(transAmount = mercValue + addOrigShipping + addRtrnShipping + caSalesTax)
transType = &quot;Enter Credit&quot;
ElseIf CrdtToBeIssd = &quot;No&quot; Then
'Condition Four - must be an exchange only i think
restockingFee = 0
transAmount = 0
transType = &quot;No Transaction&quot;
End If
End If
ElseIf shipped = &quot;No&quot; Then
If restockingFee = &quot;Yes&quot; Then
If CrdtToBeIssd = &quot;Yes&quot; Then
'Condition Five - not possible i think
ElseIf CrdtToBeIssd = &quot;No&quot; Then
'Condition Six
CDbl(restockingFee = mercValue * -.2)
CDbl(transAmount = restockingFee)
TransType = &quot;Enter Charge&quot;
End If
ElseIf restockingFee = &quot;No&quot; Then
If CrdtToBeIssd = &quot;Yes&quot; Then
'Condition Seven - not possible
restockingFee = 0
transAmount = 0
transType = 0
ElseIf CrdtToBeIssd = &quot;No&quot; Then
'Condition Eight - not possible
restockingFee = 0
transAmount = 0
transType = 0
End If
End If
End If
ElseIf california = &quot;No&quot; Then
If shipped = &quot; Yes&quot; Then
If restockingFee = &quot;Yes&quot; Then
If CrdtToBeIssd = &quot;Yes&quot; Then
'Condition Nine
CDbl(restockingFee = mercValue * .2)
CDbl(transAmount = mercValue + addOrigShipping + addRtrnShipping - restockingFee)
transType = &quot;Enter Credit&quot;
ElseIf CrdtToBeIssd = &quot;No&quot; Then
'Condition Ten
CDbl(restockingFee = mercValue * -.2)
CDbl(transAmount = mercValue + addOrigShipping + addRtrnShipping + restockingFee)
transType = &quot;Enter Credit&quot;
End If
ElseIf restockingFee = &quot;No&quot; Then
If CrdtToBeIssd = &quot;Yes&quot; Then
'Condition Eleven - not possible
restockingFee = 0
transAmount = 0
transType = &quot;No Transaction&quot;
ElseIf CrdtToBeIssd = &quot;No&quot; Then
'Condition Twelve - could only an exchange
restockingFee = 0
transAmount = 0
transType = &quot;No Transaction&quot;
End If
End If
ElseIf shipped = &quot;No&quot; Then
If restockingFee = &quot;Yes&quot; Then
If CrdtToBeIssd = &quot;Yes&quot; Then
'Condition Thirteen - no possible
restockingFee = 0
transAmount = 0
transType = &quot;No Transaction&quot;
ElseIf CrdtToBeIssd = &quot;No&quot; Then
'Condition Fourteen - could only be a cancel outside 1 hr
CDbl(restockingFee = mercValue * -.2)
CDbl(transAmount = restockingFee)
transType = &quot;Enter Charge&quot;
End If
ElseIf restockingFee = &quot;No&quot; Then
If CrdtToBeIssd = &quot;Yes&quot; Then
'Condition Fifteen - not possible
restockingFee = 0
transAmount = 0
transType = &quot;No Transaction&quot;
ElseIf CrdtToBeIssd = &quot;No&quot; Then
'Condition Sixteen
CDbl(restockingFee = 0)
CDbl(transAmount = 0)
End If
End If
End If
End If
End If
%>
 
Try this:
<%
for each objItem in request.form()
response.write(objItem & &quot; = &quot; & request.form(objItem) & &quot;<br>&quot;)
Next
%>
This will show you quickly what you named everything on the previous form and whether or not it's got a cooresponding value.
 
that shows me everything that this shows me

<table border=&quot;1&quot; bordercolor=&quot;#006699&quot; cellspacing=&quot;2&quot; cellpadding=&quot;2&quot; >
<tr>
<td>empID: </td>
<td><%= empID %></td>
</tr>
<tr>
<td>orderID: </td>
<td><%= orderID %></td>
</tr>
<tr>
<td>bAmount: </td>
<td><%= bAmount %> </td>
</tr>
<tr>
<td>bDate: </td>
<td><%= bDate %></td>
</tr>
<tr>
<td>california: </td>
<td><%= california %></td>
</tr>
<tr>
<td>complete: </td>
<td><%= complete %></td>
</tr>
<tr>
<td>custName: </td>
<td><%= custName %></td>
</tr>
<tr>
<td>email: </td>
<td><%= email %></td>
</tr>
<tr>
<td>partNumber: </td>
<td><%= partNumber %></td>
</tr>
<tr>
<td>qty: </td>
<td><%= qty %></td>
</tr>
<tr>
<td>dealer: </td>
<td><%= dealer %></td>
</tr>
<tr>
<td>mercValue: </td>
<td><%= mercValue %></td>
<tr>
<td>reason: </td>
<td><%= reason %></td>
</tr>
<tr>
<td>UnreturnableToSupp: </td>
<td><%= UnreturnableToSupp %></td>
</tr>
<tr>
<td>CrdtToBeIssd: </td>
<td><%= CrdtToBeIssd %></td>
</tr>
<tr>
<td>custRestockingFee:
<td><%= custRestockingFee %></td>
</tr>
<tr>
<td>Rcvd15Day: </td>
<td><%= Rcvd15Day %></td>
</tr>
<tr>
<td>RANempID: </td>
<td><%= RANempID %></td>
</tr>
<tr>
<td>Rfault: </td>
<td><%= Rfault %></td>
</tr>
<tr>
<td>Rshipping: </td>
<td><%= Rshipping %></td>
</tr>
<tr>
<td>addOrigShipping: </td>
<td><%= addOrigShipping %></td>
</tr>
<tr>
<td>addRtrnShipping: </td>
<td><%= addRtrnShipping %></td>
</tr>
<tr>
<td>transType: </td>
<td><%= transType %></td>
</tr>
<tr>
<td>restockingFee: </td>
<td><%= restockingFee %></td>
</tr>
<tr>
<td>transAmount:
<td><%= transAmount %></td>
</tr>
<tr>
<td>caSalesTax:
<td><%= caSalesTax %></td>
</tr>
</table>

my problem is that 3 aren't displaying, restockingFee, transAmount, and transType. Any ideas why? I've simplified it to one condition but to no avial

<%
If complete = &quot;Yes&quot; Then
If california = &quot;Yes&quot; Then
If shipped = &quot; Yes&quot; Then
If restockingFee = &quot;Yes&quot; Then
If CrdtToBeIssd = &quot;Yes&quot; Then
'Condition One
CDbl(restockingFee = mercValue * .2)
CDbl(transAmount = mercValue + addOrigShipping + addRtrnShipping + caSalesTax - restockingFee)
transType = &quot;Enter Credit&quot;
End If
End If
End If
End If
End If
%>

why doesn't that work?
 
What type of controls are they (checkboxes,radio buttons,text boxes etc.). If they are checkboxes or radio controls and they aren't checked then they won't show up on the second form period. If you've got a text box with or without a value in it, it's name will show up on the next form. IF they are text boxes, are you 100% sure that you haven't made any typos on this page like assigning your variables to request.form(&quot;Typo&quot;)?
 
i think i've figured it out, wasn't a typo in my variables but some really wierd typo like an extra space, capitilzed letter or something i'm not really sure, not even really sure what sort of typos i could make but i've got it working now. thanks alot.
 
There is more than one problem here. First, when you send data through the URL as querystring or by the form, it comes in as character data. Even if it was numeric on the first page, it is character data when request.querystring or request.form picks it up.

Knowing that, you can't simply add them together by using the &quot;+&quot; sign. VBScript (and JavaScript for that matter) don't really support a &quot;simple&quot; number type as a valid data type. Each language has a list of numeric types, so you have to work within the language's specifications (though I often call them limitations as I'm beating my head against the wall). I remember it this way: Default type is character type. That said, nTot=nVal1+nVal2 will quite likely evaluate to a concatenated string, although proper usage is to use &quot;&&quot; to obtain VBScript string concatenation. You can avoid this addition versus concatenation issue by using &quot;0+&quot; first like this: nTot=0+nVal1+nVal2. When it sees a number as the first expression, it will try to get the following expressions to evalute numerically too.

Another problem is where you typed this line:
Code:
CDbl(restockingFee = mercValue * .2)
which should probably be (I did not test)
Code:
restockingFee = CDbl(mercValue * .2)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top