Progress Bar

Hi,

I would like show to user the percentage of records read. I think to do this with a DIV, but I don’t know how to update the percentage while reading. I tried using NJX:TRIGGEREVENT component, but don’t work.

Best regards,

Alexandre Marques de Oliveira

Hi Alexandre,

the NJX:TRIGGEREVENT is only for triggering events and exchanging data between Natural and the web application tier (for instance Tomcat). It does not allow to trigger events in the browser.

If you want to somehow “block” the screen you could use a little modal dialog with a timer control and a scheduleline control. The schedulline control implements the “progress bar”. The timer control triggers events in the Natural program every X milliseconds. The Natural program can then set the corresponding values in the scheduleline and stop the timer and close the pop-up when finished (see attached screenshot)

If you don’t want to block the screen, an option would be implement a small custom control which is showing the progress using Java Script.

Best Regards,
Christine

Hi Christine,

Unfortunately, I can’t implement the progress bar. Do you have the source code of this example?

Best regards,

Alexandre

Hi Alexandre,

sorry for the delay, I forgot to attach the sample. Here it is.

It’s a Natural ONE project. Of course you can style it differently (colors …).

Best Regards,
Christine

ProgressBar.zip (8.49 KB)

Hi Christine,

Very good!!!

I only saw today the file with the example.
The program stops working when you try to run CALL ‘CMROLL’
I imagine it is a routine written in ASSEMBLER or C that is not available.
I am using z/VSE. Does the routine exist for this environment?

Best regards,

Alexandre

CMROLL is available on z/VSE, what happens when you call it ?

Take a look at program SUSPEND in lib SYSEXTP, or use USR2027N from lib SYSEXT.

Wolfgang,

Thank you for your explanation.
I understood the routine and I will not need to use it.
Now progressbar is working.

Christine… thank you for your help.

For those users with “plain vanilla” Natural, here is some code which can be used with percentages. The technique would be the same except for the letter progress; which would involve code depending on how you wanted to determine a percentage “break”.

DEFINE DATA LOCAL
1 #BAR (A60)
1 #LOOP (N2)
1 #DELAY (I2) INIT <1>
1 #LETTER (A1)
1 MYVIEW VIEW OF EMPLOYEES
2 NAME
END-DEFINE
*
READ MYVIEW IN LOGICAL SEQUENCE BY NAME
AT BREAK OF NAME /1/
ADD 1 TO #LOOP
MOVE OLD (NAME) TO #LETTER
SET CONTROL ‘N’
CALL ‘CMROLL’ #DELAY
RESET #BAR
MOVE ‘&’ TO SUBSTRING (#BAR,#LOOP,1)
WRITE 3/5 #BAR (AD=V CD=PI DY=&N$) ‘UPTO LETTER’ #LETTER
NEWPAGE
END-BREAK
END-READ
END

CMROLL is just a routine that “slows down” the bar chart, by guaranteeing a one second delay between letters.

Thanks for your help, Steve.
My problem is to create a progressbar using the PROCESS PAGE command.
The SET CONTROL ‘N’ command does not work with a web page.