Author Topic: Help with SB+ Non Gui Process/Status BAR  (Read 4654 times)

LasVegasSBUser

  • Professional
  • ***
  • Posts: 28
Help with SB+ Non Gui Process/Status BAR
« on: January 15, 2013, 09:10:03 AM »
Hey Kevin do you know what the SB.PROCESS that displays a process/status bar while a process is being Excuted wit regards to its complete status? I have a program that Selects some histroic record and takes a few minute so rather then then just display nothing I thought I could invoke something like when you do a file copy from one Windows directory to another, letting the user know where the Process is. I know FWDavison did something like but I did not use all that much and can't remember how they did it.

LasVegasSBUser

  • Professional
  • ***
  • Posts: 28
Re: Help with SB+ Non Gui Process/Status BAR
« Reply #1 on: January 15, 2013, 09:21:57 AM »
Sorry Kevin I did not see this.
 
This isn't a question, it's more of a "trick" that many may already know, but some may not.

When running a GUI screen that processes a large quantity of data that tends to take a long time to traverse, your users may grow impatient when they don't know where the process is between start and finish.  In my travels I have come across a method you can use to show a graphic progress bar in the status line of your screen, providing a finished, professional-looking indicator to the user.  This is much better than the old-fashioned "xxx of yyyyy records processed" text.  This only works if you know the total number of records or items you're processing.

In the example below, I'll assume we're looping through a list of Purchase Orders. Before you begin processing the list, add the following in your code, where "NUM.ITEMS" is the number of items you're traversing.

CALL SB.DISP(9,"Processing Purchase Orders ":@AM:0:@AM:NUM.ITEMS)  ;* That is a zero, not the letter O, between the @AM's

Inside the loop, after you increment your looping variable (assuming a looping variable of L.LOOP), do the following:

CALL SB.DISP(9,"Processing Purchase Orders ":@AM:L.LOOP:@AM:NUM.ITEMS)

You can display the above on every iteration, or set up your code to do it on every 10th, 100th, whatever, if you want to cut down on the I/O.

When you run your process, you will get a nice solid color progress bar that creeps across the screen as progress is made, keeping your user informed (and less likely to exit the session)...

If anyone else has any tips or tricks that they have found useful, please share! 

Jim

precisonline

  • President
  • Administrator
  • Rock Star
  • *****
  • Posts: 1612
    • Precision Solutions
Re: Help with SB+ Non Gui Process/Status BAR
« Reply #2 on: January 15, 2013, 10:12:47 AM »
Excellent tip!  Thanks so much for sharing!
-Kevin
Accidents "happen"; success, however, is planned and executed.

Tom Pellitieri

  • Rock Star
  • *****
  • Posts: 224
  • Tom Pellitieri - Toledo, Ohio
Re: Help with SB+ Non Gui Process/Status BAR
« Reply #3 on: January 17, 2013, 01:38:05 PM »
If you don't have a GUI screen, you can simulate a progress bar with the right characters.  Here's a quick demo you can run from a paragraph (/PD.P).

LOCAL PCT,HALF
FOR PCT = 0 TO 100 STEP 2
   HALF = INT(PCT / 2)
   DISP 9,"Processed ":OCONV(PCT,"MR0#3"):"% ":STR(CHAR(219),HALF):STR(CHAR(196),50-HALF)
   SLEEP 1
NEXT TMP


This relies on the correct ASCII set for your terminal emulation.  On our system, CHAR(219) is a solid white box, and CHAR(196) is a horizontal single line box drawing character.  You could use a combination of "#" and "-" instead.  The progress bar is only 50 characters, so you need to use 1/2 of the percentage to determine the number of each character to use.

--Tom