• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 137
  • Last Modified:

Need help to rewrite script

I have this script:
sub pddinstock()
      if useStockManagement AND showinstock=TRUE then if cint(rs("pStockByOpts"))=0 then print "<div class=""prodinstock detailinstock""><strong>" & xxInStoc & ":</strong> " & vrmax(0,rs("pInStock")) & "</div>"
end sub

I need to change it so that " & vrmax(0,rs("pInStock")) & " returns an output like "Few items left."  instead of the " & vrmax(0,rs("pInStock")) & " value when the value of " & vrmax(0,rs("pInStock")) & " is less than 5 and when the value of " & vrmax(0,rs("pInStock")) & " is more than 5 it should say "In stock."

I have tried to rewrite the script, but as I'm doing it in Notepad I have to test it after each modification and I have still not figured it out. Now I've been at it for a few hours. Anyone know how to rewrite it?

Many thanks in advance.

Best regards,
Evert
1
Evert Jor
Asked:
Evert Jor
1 Solution
 
Big MontySenior Web Developer / CEO of ExchangeTree.org Commented:
try

sub pddinstock()
      inStockText = "a few items left"
      if CInt( vrmax(0,rs("pInStock")) ) > 5 then inStockText = "in stock"

      if useStockManagement AND showinstock=TRUE then
          if cint(rs("pStockByOpts"))=0 then
              print "<div class=""prodinstock detailinstock""><strong>" & xxInStoc & ":</strong> " & inStockText & "</div>"
          end if
     end if
end sub
0
 
xtermieCommented:
This expert suggested creating a Gigs project.
Could you explain your variables?

It looks smt like
sub pddinstock()
       if useStockManagement AND showinstock=TRUE then
            if cint(rs("pStockByOpts"))=0 then
                 'does this means there is stock available
                  if xxInStock < 5 then msgbox "your message"  else msgbox "your second message"
            end if
       end if
       
 end sub
0
 
Evert JorDVM/ResearcherAuthor Commented:
Excellent solution.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now