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.
Alexandre Marques de Oliveira
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.
Unfortunately, I can’t implement the progress bar. Do you have the source code of this example?
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 …).
ProgressBar.zip (8.49 KB)
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?
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.
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
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
MOVE ‘&’ TO SUBSTRING (#BAR,#LOOP,1)
WRITE 3/5 #BAR (AD=V CD=PI DY=&N$) ‘UPTO LETTER’ #LETTER
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.