Assigning a Progress Bar in forms 6i (Urgent) [message #210256] |
Wed, 20 December 2006 01:07 |
syedmajidahmed
Messages: 4 Registered: December 2006 Location: Hyderabad,India
|
Junior Member |
|
|
Author: Syed Majid Ahmed, India
Date: Dec 20, 2006.
Os info: Windows XP [version 5.1.2600]
Oracle info: oracle 9i enterprise edition 9.2.0.10
Message: In the form, I have a button which does posting to GL based on the transactions for a particular month. It has many inserts,updates and deletes. I want to show a progress bar.
I have also had a look at this url http://ourworld.compuserve.com/homepages/Peter_Koletzke/tip.htm and look for progres meter as suggested by Hans Van Driel, Netherlands.
But still progress bar is not working if process is running and vise versa.
|
|
|
Re: Assigning a Progress Bar in forms 6i (Urgent) [message #210395 is a reply to message #210256] |
Wed, 20 December 2006 10:38 |
yogen
Messages: 39 Registered: October 2006 Location: UK
|
Member |
|
|
you will have to modify the code....i have implemented it the modified code is
PACKAGE BODY PROGRESS_BAR IS
PROCEDURE Show_Bar (percent IN NUMBER := 0) IS
bar_width NUMBER; -- computed width of bar
IT_ID1 ITEM;
BEGIN
bar_width := ROUND((Progress_Bar.full_width)
/ 100 * percent,2);
SET_ITEM_PROPERTY(Progress_Bar.bar_id,WIDTH, bar_width);
COPY(RTRIM(TO_CHAR(ROUND(percent,0)) || '%'),'progress_bar.percent');
SYNCHRONIZE;
IF percent >= 100 THEN -- job completed
Progress_Bar.Hide_Progress_Bar;
END IF;
END Show_Bar;
PROCEDURE Initialize_Progress_Bar IS
it_id varchar2(200);
IT_ID1 ITEM;
BEGIN
IF Progress_Bar.Initialized THEN
MESSAGE('A Progress Bar is already initialized');
RAISE FORM_TRIGGER_FAILURE;
ELSIF Progress_Bar.full_width IS NULL THEN
Progress_Bar.bar_id :=
FIND_ITEM('PROGRESS_BAR.BAR');
Progress_Bar.full_width := TO_NUMBER(GET_ITEM_PROPERTY(Progress_Bar.bar_id, WIDTH));
IT_ID1 := Find_Item('PROGRESS_BAR.BAR');
SET_ITEM_PROPERTY(it_id1,VISIBLE,PROPERTY_TRUE);
IT_ID1 := Find_Item('PROGRESS_BAR.PERCENT');
SET_ITEM_PROPERTY(it_id1,VISIBLE,PROPERTY_TRUE);
END IF;
IF Progress_Bar.Return_item IS NULL THEN
it_id := :SYSTEM.TRIGGER_ITEM;
-- message('Item to be returned is:'||it_id);
-- message('Item to be returned is:'||it_id);
-- Pause;
Progress_Bar.Return_item :=
NAME_IN('SYSTEM.TRIGGER_ITEM');
END IF;
Progress_Bar.Initialized := TRUE;
Show_Bar(0);
END;
PROCEDURE Show_Progress_Bar (percent IN NUMBER := 0) IS
BEGIN
IF NOT Progress_Bar.Initialized THEN
MESSAGE('No Progress Bar has been initialized');
RAISE FORM_TRIGGER_FAILURE;
END IF;
Show_Bar(percent);
END ;
PROCEDURE Hide_Progress_Bar IS
IT_ID1 ITEM;
BEGIN
IT_ID1 := Find_Item('PROGRESS_BAR.BAR');
SET_ITEM_PROPERTY(it_id1,VISIBLE,PROPERTY_FALSE);
IT_ID1 := Find_Item('PROGRESS_BAR.PERCENT');
SET_ITEM_PROPERTY(it_id1,VISIBLE,PROPERTY_FALSE);
-- SET_ITEM_PROPERTY(Progress_Bar.bar_id,WIDTH, 0);
Progress_Bar.full_width := NULL;
GO_ITEM(Progress_Bar.return_item);
-- GO_ITEM(:SYSTEM.TRIGGER_ITEM);
Progress_Bar.Return_item := NULL;
Progress_Bar.Initialized := FALSE;
--SET_WINDOW_PROPERTY('PROCESSING_BAR',VISIBLE,PROPERTY_FALSE);
END Hide_Progress_Bar;
END;
PACKAGE PROGRESS_BAR IS
----------------------------------------------- Public Variable
return_item VARCHAR2(32);
bar_id ITEM; -- id of the bar
view_id VIEWPORT ; -- id of the canvas
full_width NUMBER; -- full width before modifying
return_item VARCHAR2(32); -- return item
Initialized BOOLEAN;
--------------------------------------------- Public Procedures
PROCEDURE Initialize_Progress_Bar ;
PROCEDURE Show_Progress_Bar (percent IN NUMBER := 0);
PROCEDURE Hide_Progress_Bar ;
END PROGRESS_BAR;
I have created one data block (Named as PROGRESS_BAR) having 2 items PERCENT and BAR.and showing this data block also on my main canvas.
and to implement you will have to wrtie a code like this
PROCEDURE P_CALCULATE_IMPORTANCE_TC(p_TECHNICALCONFIG
cursor C1 is
select b.CUSTOMERCODE CUSTOMERCODE, rowid r_num
FROM SDB_CUSTOMER_TECHCONFIG_FORM b
where b.TECHNICALCONFIG = p_TECHNICALCONFIG;
BEGIN
PROGRESS_BAR.Initialize_Progress_Bar;
for cl_rec in C1 LOOP
-- :global.c_totis the total number of records to be processed.
--c_done total number of records processed.
p_percent := trunc(c_done*100/:global.c_tot);
if p_percent >= 100 then
p_percent := 100;
end if;
PROGRESS_BAR.Show_Progress_Bar(p_percent);
END LOOP;
END;
Hope this will help you if you have any queries let me know.
|
|
|
|