Progress Bar

i need to Create one codeunit and write the code in such a way that if i run the codeunit, one progress bar should run for 60 seconds with the status.

“Window”,“Update” functions need to be used for this with some temporary variables.

i even checked codeunit 80 for reference by searching “window”, but it was so complicated[:’(].

can anyone please help?

thanks in advance:)

Hi Shona

Create a function at your own code unit with a parameter then place below code at the function which u created newly.befor that create a global variable called window with data type Dialog.

window.OPEN(’#1#################################\’ + ‘Processing’);
window.UPDATE(1,);

call the function with parameter

Thanks

Jerome Marshal.J

You might also have a look here (including an example): Progress Dialogs and Performance.

thanks luc!

hi:)

are you saying that i create a new codeunit with any function say “Progress” and place this code below?

i have begin taught about this window coding properly! so how ‘#’ should i put? is the a definite no.?

Thanks:)

sorry i meant i havent been taught about this coding using window

hi marshal,

i hav created the variable { bar } and function { progress }

should i code it like this?

window.OPEN(’#1#################################\’ + ‘Processing’);
window.UPDATE(1,);

thanks,

Hi Shona
The windows are used to show current record which is in progress.so your requirment is
need to show the record with a status bar to show the % of records were completed.for your practice purpose lets create a report and and step by step i ill explain ok.forgot about my previous post.

Step 1

Creat a simple report to show the list of customers.And name the report as CustomerListI using the data item 18 and place Customer No and Customer Name fields in report

Step2

create the following variables in newly created report

VarName DataType SubType
LineCount integer
NoOfRecords Integer
Cust record Customer
window Dialog

Step3

Place the below code at Customer, Body (2) - OnPreSection() of the newly created report

LineCount:=LineCount+1;
Cust.RESET;
NoOfRecords:=Cust.COUNT;
window.OPEN(’#1################### @2@@@@@@@@@@@@@’);
window.UPDATE(1,Custname);
window.UPDATE(2,ROUND(LineCount/NoOfRecords * 10000,1));

Step4

Run your report now you can see the process window with status bar


#1################### mean yu are creating a filed in the window in run time with the control number 1

@2@@@@@@@@@@@@@ mean you are creating a process Bar with control number 2 in run time

window.UPDATE(1,Custname); this code will unpdate the customer name at the control1
window.UPDATE(2,ROUND(LineCount/NoOfRecords * 10000,1)); this will update the process bar

Sample Process bar

8117.Process Bar.bmp (267 KB)

Thanks

Marshal.J

Thanks dude[:D]

i was busy till now! will try this out and let you know.!

hi

i should create an variable custname or should a dot come inbetween cust ans name like cust.name?

hi marshal,

i have create an variable custname as text and i tried running that report! i could see an dialog box which was rapidly runing the process { the ones we see when we try to login in, the process bar with green liness} but it wasnt clear. it was running very fast. then it produced my report with name and no! where did i go wrong?

thanks,

So your seeing the process bar with green blocks.so that the problem is the window is opening every time it should be open only one time so cut the code window.OPEN(’#1################### @2@@@@@@@@@@@@@’); from Body (2) - OnPreSection()
and paste it in Customer, Header (1) - OnPostSection()

2.Yes the report will print its records. for your practice purpose i was asked you to creat a report you don’t want to print the report?

Thanks
Marshal

No i dont want to print. i dont want reports to begin with. i want all these coding done in code units.

And i didnt get any dialog box as you specified! it was just a box with no writing, only the progress bar showing!

thanks,

Thanks Marshal, this worked!

creat a code unit and copy paste the below coding at OnRun() of the newly created code unit.Befor that creat two variables window with data type Dialog and I with data type integer.

window.OPEN(’@1@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@’);
FOR I:= 1 TO 170000 DO
window.UPDATE(1,I);
window.CLOSE;

Now Run the code unit thats all

There is a slight change in the previous code! but this one works perfectly:)

window.OPEN(’@1@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@’);
FOR i:= 1 TO 300000 DO
window.UPDATE(1,ROUND((i/300000)*10000,1));
window.CLOSE;

But also pay attention to the performance degration when using progress dialogs!

Hi Marshal,

sorry may I clarify with you some doubt please?

1.does the length of ’ # ’ or ’ @ ’ matter ?

2.how difference if i put the progress bar in pre-date item & section code?

3.i saw a / sign, what does it means?

Hi Nikeman

  1. Yes if you reduce the no of ‘@’ or ‘#’ used, then the size of the dialog window will be reduced

  2. If you use the Progress window in pre data item it will run only once per report. And if you use Progress bar in the section triggers, then it will run based on the section for example if you used in the body section of a report it will run each and every record of the data item

  3. '/’ will not do any changes, it was mistakenly included

Thanks

Jerome Marshal. J

Thank U