Solved

Need help to rewrite script

Posted on 2016-10-22
3
48 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 32

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 17

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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

When it comes to writing scripts for a Client/Server computing environment it is essential to consider some way of enabling the authentication functionality within a script. This sort of consideration mainly comes into the picture when we are dealin…
Introduction During my participation as a VBScript contributor at Experts Exchange, one of the most common questions I come across is this: "I have a script that runs against only one computer. How can I make it run against a list of computers in …
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
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 …

705 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now