1. Member
Join Date
Dec 1969
Posts
98

## need help please..

Hi<BR><BR>I have the following code:<BR><BR>&#060;%If qtyavailable=0 then%&#062;<BR>&#060;font size=1 color=navy&#062;Stock available 3 day delivery &#060;/font&#062;<BR>&#060;%else%&#062;<BR>&#060;%If qtyavailable&#060;0 then%&#062;<BR>&#060;font size=1 color=navy&#062;Stock available 5 day delivery &#060;/font&#062;<BR>&#060;%else%&#062;<BR>&#060;font size=2 color=navy&#062;&#060;% = qtyavailable %&#062;&#060;/font&#062;<BR>&#060;%end if%&#062;<BR>&#060;%end if%&#062;<BR><BR>I would like to add another option which says, <BR><BR>If qtyavailable&#060;0 but less than -5<BR>show this text<BR>else<BR>If qtyavailable&#060;-5<BR>show this....<BR><BR>how do i do that?<BR><BR>thanks

2. Sathiya Guest

## RE: need help please..

If qtyavailable&#060;0 but less than -5<BR> what this means<BR><BR>if qty is less than 0 and less than -5 is that the meaning if a value is less then -5 it should be less than 0 why need a first check. If my vies are wrong reply me.

3. Senior Member
Join Date
Dec 1969
Posts
120

## RE: need help please..

You&#039ll find it easier to output your text as a variable. Have 2 If...then...else statements first says if qtyavailable &#060;0 then msg = "show text". The next says If qrtavailable &#060;-5 then msg = "show this text". Values &#060;0 but greater (assume you mean this) than -5 will pass first and fail second If. Values less than -5 will pass both If&#039s and therefore output second msgtext.<BR>Then add &#060;font size=2 color=navy&#062;&#060;% = msg %&#062;&#060;/font&#062;<BR>

4. Mr Swifty Guest

## RE: need help please..

I could be wrong here, but do you instead want it to be:<BR>If qtyavailable&#060;0 but GREATER than -5 ?<BR><BR>In which case it would be:<BR><BR>If qtyavailable &#060; 0 And qtyavailable &#062; -5 Then<BR>&#039show this text<BR>ElseIf qtyavailable &#060; -5 Then<BR>&#039show this....<BR>End If<BR><BR>But maybe I&#039ve missed your point. Anyway......

5. Senior Member
Join Date
Dec 1969
Posts
177

## RE: a full code alternative

also<BR>&#060;HTML&#062;<BR>&#060;BODY&#062;<BR>&# 060;%<BR>DIM qtyavailable<BR><BR>&#039.... assign qtyavailable here somewhere<BR><BR>qtyavailable = -3<BR><BR>If qtyavailable &#060; -5 Then<BR> Response.Write "&#060;font size=1 color=navy&#062;Stock available after more than 5 days &#060;/font&#062;"<BR>Else<BR> If qtyavailable &#060; 0 Then<BR> Response.Write "&#060;font size=1 color=navy&#062;Stock available 5 day delivery &#060;/font&#062;"<BR> Else<BR> If qtyavailable = 0 Then<BR> Response.Write "&#060;font size=1 color=navy&#062;Stock available 3 day delivery &#060;/font&#062;"<BR> Else<BR> Response.Write "&#060;font size=2 color=navy&#062;" & qtyavailable & "&#060;/font&#062;"<BR> End If<BR> End IF<BR>End If<BR>%&#062;<BR>&#060;/BODY&#062;<BR>&#060;/HTML&#062;

6. Senior Member
Join Date
Dec 1969
Posts
177

## code tester /demo

&#060;HTML&#062;<BR>&#060;BODY&#062;<BR>&#060;%<BR >DIM qtyavailable<BR><BR>&#039.... assign qtyavailable here somewhere<BR><BR>qtyavailable = request("QTYAVAILABLE")<BR>if qtyavailable = "" then qtyavailable = 0 End If<BR><BR> If qtyavailable &#060; -5 Then<BR> Response.Write "&#060;font size=1 color=navy&#062;Stock available after more than 5 days &#060;/font&#062;"<BR> Else<BR> If qtyavailable &#060; 0 Then<BR> Response.Write "&#060;font size=1 color=navy&#062;Stock available 5 day delivery &#060;/font&#062;"<BR> Else<BR> If qtyavailable = 0 Then<BR> Response.Write "&#060;font size=1 color=navy&#062;Stock available 3 day delivery &#060;/font&#062;"<BR> Else<BR> Response.Write "&#060;font size=2 color=navy&#062;" & qtyavailable & "&#060;/font&#062;"<BR> End If<BR> End If<BR> End If<BR><BR><BR><BR>%&#062;<BR>&#060;FORM&#062;<BR>T est qty code with this value:<BR>&#060;INPUT TYPE="TEXT" NAME="QTYAVAILABLE" VALUE=&#060;%= QTYAVAILABLE %&#062; SIZE=4&#062;<BR>&#060;INPUT TYPE=SUBMIT &#062;<BR>&#060;/FORM&#062;<BR>&#060;/BODY&#062;<BR>&#060;/HTML&#062;

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•