Solved

Need help to rewrite script

Posted on 2016-10-22
3
102 Views
1 Endorsement
Last Modified: 2016-10-22
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
Comment
Question by:EvertJor
3 Comments
 
LVL 33

Accepted Solution

by:
Big Monty earned 500 total points
ID: 41855210
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
 
LVL 18

Expert Comment

by:xtermie
ID: 41855223
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
 

Author Closing Comment

by:EvertJor
ID: 41855254
Excellent solution.
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I hope you'll find this tutorial useful and interesting. So let's try to extend Tcl with a new package.  For anyone more deeply interested please check out the book "Practical Programming in Tcl and Tk". It's really one of the best written books abo…
This article will show, step by step, how to integrate R code into a R Sweave document
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

685 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question