Home » Developer & Programmer » Forms » Progress bar not working...
Progress bar not working... [message #535003] Sun, 11 December 2011 01:10 Go to next message
aallan
Messages: 150
Registered: October 2011
Senior Member
Dear All;
i have this procedure in my form to make some checks on employee data:

Procedure Pu_Check_Emp_Positions_Prc Is

 Cursor vc_get_users_data_case1 Is
 Select A.User_No, A.User_Responsility, A.User_Position, B.User_Status
   From Import_Emp_Positions_Dtl A,
        Shows_Users B
  Where A.User_No                      = B.User_No
    And (Substr(A.User_Position, 1, 1) = 'R' Or Substr(A.User_Position, 1, 1) = 'r')
    And A.User_Responsility           Is Not Null
    And B.User_Status                 In (2, 3, 4, 7, 8);
    --And A.User_No                      = 'XSER0001';
    
 Cursor vc_get_users_data_case2 Is
 Select A.User_No, A.User_Responsility, A.User_Position, B.User_Status
   From Import_Emp_Positions_Dtl A,
        Shows_Users B
  Where A.User_No                      = B.User_No
    And (Substr(A.User_Position, 1, 1) = 'R' Or Substr(A.User_Position, 1, 1) = 'r')
    And A.User_Responsility           Is Null
    And B.User_Status                  = 1;
    --And A.User_No                      = 'XSER0001';
    
 Cursor vc_get_users_data_case3 Is
 Select A.User_No, A.User_Responsility, A.User_Position, B.User_Status
   From Import_Emp_Positions_Dtl A,
        Shows_Users B
  Where A.User_No                      = B.User_No
    And (Substr(A.User_Position, 1, 1) = 'R' Or Substr(A.User_Position, 1, 1) = 'r')
    And A.User_Responsility           Is Not Null
    And B.User_Status                  = 1;
    --And A.User_No                      = 'XSER0001';
    
 Cursor vc_get_users_data_case4 Is
 Select A.User_No, A.User_Responsility, A.User_Position, B.User_Status
   From Import_Emp_Positions_Dtl A,
        Shows_Users B
  Where A.User_No                      = B.User_No
    And (Substr(A.User_Position, 1, 1) = 'R' Or Substr(A.User_Position, 1, 1) = 'r')
    And A.User_Responsility           Is Null
    And B.User_Status                 In (2, 3, 4, 7, 8);
    --And A.User_No                      = 'XSER0001';
    
 Cursor vc_get_users_data_case5 Is
 Select A.User_No, A.User_Responsility, A.User_Position, B.User_Status, B.Authority_Code
   From Import_Emp_Positions_Dtl A,
        Shows_Users B
  Where A.User_No                      = B.User_No
    And (Substr(A.User_Position, 1, 7) = 'STC_IDS' Or Substr(A.User_Position, 1, 8) = 'STC_HOME'
     Or Substr(A.User_Position, 1, 6)  = 'STC_CE'  Or Substr(A.User_Position, 1, 6) = 'STC_DS')
    And A.User_Responsility           Is Not Null
    And B.User_Status                 In (2, 3, 4, 7, 8)
    And B.Authority_Code               Is Not Null;
    --And A.User_No                      = 'XSER0009';
    
 Cursor vc_get_users_data_case6 Is
 Select A.User_No, A.User_Responsility, A.User_Position, B.User_Status, B.Authority_Code
   From Import_Emp_Positions_Dtl A,
        Shows_Users B
  Where A.User_No                      = B.User_No
    And (Substr(A.User_Position, 1, 7) = 'STC_IDS' Or Substr(A.User_Position, 1, 8) = 'STC_HOME'
     Or Substr(A.User_Position, 1, 6)  = 'STC_CE'  Or Substr(A.User_Position, 1, 6) = 'STC_DS')
    And A.User_Responsility           Is Null
    And B.User_Status                  = 1;
    --And A.User_No                      = 'XSER0009';
    
 Cursor vc_get_users_data_case7 Is
 Select A.User_No, A.User_Responsility, A.User_Position, B.User_Status, B.Authority_Code
   From Import_Emp_Positions_Dtl A,
        Shows_Users B
  Where A.User_No                      = B.User_No
    And (Substr(A.User_Position, 1, 7) = 'STC_IDS' Or Substr(A.User_Position, 1, 8) = 'STC_HOME'
     Or Substr(A.User_Position, 1, 6)  = 'STC_CE'  Or Substr(A.User_Position, 1, 6) = 'STC_DS')
    And A.User_Responsility           Is Null
    And B.User_Status                 In (2, 3, 4, 7, 8);
    --And A.User_No                      = 'XSER0009';
    
 Cursor vc_get_users_data_case8 Is
 Select A.User_No, A.User_Responsility, A.User_Position, B.User_Status, B.Authority_Code
   From Import_Emp_Positions_Dtl A,
        Shows_Users B
  Where A.User_No                      = B.User_No
    And (Substr(A.User_Position, 1, 7) = 'STC_IDS' Or Substr(A.User_Position, 1, 8) = 'STC_HOME'
     Or Substr(A.User_Position, 1, 6)  = 'STC_CE'  Or Substr(A.User_Position, 1, 6) = 'STC_DS')
    And A.User_Responsility           Is Not Null
    And B.User_Status                  = 1
        And B.Authority_Code           Is Not Null;
    --And A.User_No                      = 'XSER0009';                                   
 
  vn_count1                 Number := 0;
  vn_count2                 Number := 0;
  vn_count3                 Number := 0;
  vn_count4                 Number := 0;
  vn_count5                 Number := 0;
  vn_count6                 Number := 0;
  vn_count7                 Number := 0;
  vn_count8                 Number := 0;    
Begin
--================================================================================================================================================================
 For Rec In vc_get_users_data_case1 Loop
  Begin
   Select Count(*)
     Into vn_count1
     From Sale_Employee_Positions
    Where User_No              = Rec.User_No
      And Upper(User_Position) = Upper(Rec.User_Position);
   Exception When No_Data_Found Then
  	vn_count1 := 0;
  End;

   Insert Into Rejected_Employee_Positions (User_No, Rejected_Reason, User_Id, System_Date, Import_Id, Import_Date)
                                    Values (Rec.User_No, 'ÇáãÓÊÎÏã ãæÞÝ Ýí äÙÇã Óíá æíæÌÏ áå ÕáÇÍíÇÊ', :Global.User, Sysdate, :Blk_1.Import_Id, :Blk_1.Import_Date);
    Delete Sale_User_Authority
     Where User_No = Rec.User_No;

    Delete Sale_User_Authority_Groups
     Where User_No = Rec.User_No;

    If vn_count1 >= 1 Then
     	Update Sale_Employee_Positions
     	   Set Current_Position     = 0
     	 Where Upper(User_Position) <> Upper(Rec.User_Position);    	
    	 
     	Update Sale_Employee_Positions
     	   Set Current_Position     = 1
     	 Where Upper(User_Position) = Upper(Rec.User_Position);
    Else
     	Insert Into Sale_Employee_Positions (User_No, User_Position, Issue_Date, User_Id, System_Date, Current_Position)
     	                             Values (Rec.User_No, Rec.User_Position, Sysdate, :Global.User, Sysdate, 1);
    End If;
 End Loop;
--================================================================================================================================================================
 For Rec1 In vc_get_users_data_case2 Loop
  Begin
   Select Count(*)
     Into vn_count2
     From Sale_Employee_Positions
    Where User_No              = Rec1.User_No
      And Upper(User_Position) = Upper(Rec1.User_Position);
   Exception When No_Data_Found Then
  	vn_count2 := 0;
  End;

   Update Shows_Users
      Set User_Status = 7
    Where User_No = Rec1.User_No;
   
   Insert Into Rejected_Employee_Positions (User_No, Rejected_Reason, User_Id, System_Date, Import_Id, Import_Date)
                                    Values (Rec1.User_No, 'ÇáãÓÊÎÏã ãæÞÝ ÍÇáíÇ Ýí äÙÇã ÓíÈá', :Global.User, Sysdate, :Blk_1.Import_Id, :Blk_1.Import_Date);
    Delete Sale_User_Authority
     Where User_No = Rec1.User_No;

    Delete Sale_User_Authority_Groups
     Where User_No = Rec1.User_No;

    If vn_count2 >= 1 Then
     	Update Sale_Employee_Positions
     	   Set Current_Position     = 0
     	 Where Upper(User_Position) <> Upper(Rec1.User_Position);    	
    	 
     	Update Sale_Employee_Positions
     	   Set Current_Position     = 1
     	 Where Upper(User_Position) = Upper(Rec1.User_Position);
    Else
     	Insert Into Sale_Employee_Positions (User_No, User_Position, Issue_Date, User_Id, System_Date, Current_Position)
     	                             Values (Rec1.User_No, Rec1.User_Position, Sysdate, :Global.User, Sysdate, 1);
    End If;
 End Loop;
--================================================================================================================================================================
 For Rec2 In vc_get_users_data_case3 Loop
  Begin
   Select Count(*)
     Into vn_count3
     From Sale_Employee_Positions
    Where User_No              = Rec2.User_No
      And Upper(User_Position) = Upper(Rec2.User_Position);
   Exception When No_Data_Found Then
  	vn_count3 := 0;
  End;

   Update Shows_Users
      Set User_Status = 8
    Where User_No = Rec2.User_No;
   
   Insert Into Rejected_Employee_Positions (User_No, Rejected_Reason, User_Id, System_Date, Import_Id, Import_Date)
                                    Values (Rec2.User_No, 'íæÌÏ ãÔßáÉ Ýí ÇáãæÙÝ áÇäå ãæÞÝ æáå ÕáÇÍíÇÊ æÍÇáÊå íÚãá', :Global.User, Sysdate, 
                                            :Blk_1.Import_Id, :Blk_1.Import_Date);
    Delete Sale_User_Authority
     Where User_No = Rec2.User_No;

    Delete Sale_User_Authority_Groups
     Where User_No = Rec2.User_No;

    If vn_count3 >= 1 Then
     	Update Sale_Employee_Positions
     	   Set Current_Position     = 0
     	 Where Upper(User_Position) <> Upper(Rec2.User_Position);    	
    	 
     	Update Sale_Employee_Positions
     	   Set Current_Position     = 1
     	 Where Upper(User_Position) = Upper(Rec2.User_Position);
    Else
     	Insert Into Sale_Employee_Positions (User_No, User_Position, Issue_Date, User_Id, System_Date, Current_Position)
     	                             Values (Rec2.User_No, Rec2.User_Position, Sysdate, :Global.User, Sysdate, 1);
    End If;
 End Loop;
--================================================================================================================================================================
 For Rec3 In vc_get_users_data_case4 Loop
  Begin
   Select Count(*)
     Into vn_count4
     From Sale_Employee_Positions
    Where User_No              = Rec3.User_No
      And Upper(User_Position) = Upper(Rec3.User_Position);
   Exception When No_Data_Found Then
  	vn_count4 := 0;
  End;

   Update Shows_Users
      Set User_Status = 8
    Where User_No = Rec3.User_No;
   
   Insert Into Rejected_Employee_Positions (User_No, Rejected_Reason, User_Id, System_Date, Import_Id, Import_Date)
                                    Values (Rec3.User_No, 'íæÌÏ ãÔßáÉ Ýí ÇáãæÙÝ áÇäå ãæÞÝ æáå ÕáÇÍíÇÊ æÍÇáÊå íÚãá', :Global.User, Sysdate, 
                                            :Blk_1.Import_Id, :Blk_1.Import_Date);
    Delete Sale_User_Authority
     Where User_No = Rec3.User_No;

    Delete Sale_User_Authority_Groups
     Where User_No = Rec3.User_No;

    If vn_count4 >= 1 Then
     	Update Sale_Employee_Positions
     	   Set Current_Position     = 0
     	 Where Upper(User_Position) <> Upper(Rec3.User_Position);    	
    	 
     	Update Sale_Employee_Positions
     	   Set Current_Position     = 1
     	 Where Upper(User_Position) = Upper(Rec3.User_Position);
    Else
     	Insert Into Sale_Employee_Positions (User_No, User_Position, Issue_Date, User_Id, System_Date, Current_Position)
     	                             Values (Rec3.User_No, Rec3.User_Position, Sysdate, :Global.User, Sysdate, 1);
    End If;
 End Loop;
--================================================================================================================================================================
 For Rec4 In vc_get_users_data_case5 Loop
  Begin
   Select Count(*)
     Into vn_count5
     From Sale_Employee_Positions
    Where User_No              = Rec4.User_No
      And Upper(User_Position) = Upper(Rec4.User_Position);
   Exception When No_Data_Found Then
  	vn_count5 := 0;
  End;

   Update Shows_Users
      Set User_Status = 1
    Where User_No = Rec4.User_No;

   Insert Into Rejected_Employee_Positions (User_No, Rejected_Reason, User_Id, System_Date, Import_Id, Import_Date)
                                    Values (Rec4.User_No, 'íæÌÏ ãÔßáÉ Ýí ÇáãæÙÝ áÇäå íÚãá æíæÌÏ áå ÕáÇÍíÉ æÍÇáÊå Ýí ÇáäÙÇã ãæÞÝ', :Global.User, Sysdate, 
                                            :Blk_1.Import_Id, :Blk_1.Import_Date);

    Pu_Insert_Authority_Groups_Prc (Rec4.User_No, Rec4.Authority_Code);  -- Refresh The Authority and Groups for User.                                                                                       

    If vn_count5 >= 1 Then
     	Update Sale_Employee_Positions
     	   Set Current_Position     = 0
     	 Where Upper(User_Position) <> Upper(Rec4.User_Position);    	
    	 
     	Update Sale_Employee_Positions
     	   Set Current_Position     = 1
     	 Where Upper(User_Position) = Upper(Rec4.User_Position);
    Else
     	Insert Into Sale_Employee_Positions (User_No, User_Position, Issue_Date, User_Id, System_Date, Current_Position)
     	                             Values (Rec4.User_No, Rec4.User_Position, Sysdate, :Global.User, Sysdate, 1);
    End If;
 End Loop;
--================================================================================================================================================================
 For Rec5 In vc_get_users_data_case6 Loop
  Begin
   Select Count(*)
     Into vn_count6
     From Sale_Employee_Positions
    Where User_No              = Rec5.User_No
      And Upper(User_Position) = Upper(Rec5.User_Position);
   Exception When No_Data_Found Then
  	vn_count6 := 0;
  End;

   Update Shows_Users
      Set User_Status = 8
    Where User_No = Rec5.User_No;

   Insert Into Rejected_Employee_Positions (User_No, Rejected_Reason, User_Id, System_Date, Import_Id, Import_Date)
                                    Values (Rec5.User_No, 'íæÌÏ ãÔßáÉ Ýí ÇáãæÙÝ áÇäå íÚãá æáÇ íæÌÏ áå ÕáÇÍíÉ æÍÇáÊå Ýí ÇáäÙÇã íÚãá', :Global.User, Sysdate, 
                                            :Blk_1.Import_Id, :Blk_1.Import_Date);
    Delete Sale_User_Authority
     Where User_No = Rec5.User_No;

    Delete Sale_User_Authority_Groups
     Where User_No = Rec5.User_No;                                                                                      

    If vn_count6 >= 1 Then
     	Update Sale_Employee_Positions
     	   Set Current_Position     = 0
     	 Where Upper(User_Position) <> Upper(Rec5.User_Position);    	
    	 
     	Update Sale_Employee_Positions
     	   Set Current_Position     = 1
     	 Where Upper(User_Position) = Upper(Rec5.User_Position);
    Else
     	Insert Into Sale_Employee_Positions (User_No, User_Position, Issue_Date, User_Id, System_Date, Current_Position)
     	                             Values (Rec5.User_No, Rec5.User_Position, Sysdate, :Global.User, Sysdate, 1);
    End If;
 End Loop;
--================================================================================================================================================================
 For Rec6 In vc_get_users_data_case7 Loop
  Begin
   Select Count(*)
     Into vn_count7
     From Sale_Employee_Positions
    Where User_No              = Rec6.User_No
      And Upper(User_Position) = Upper(Rec6.User_Position);
   Exception When No_Data_Found Then
  	vn_count7 := 0;
  End;

   Insert Into Rejected_Employee_Positions (User_No, Rejected_Reason, User_Id, System_Date, Import_Id, Import_Date)
                                    Values (Rec6.User_No, 'íæÌÏ ãÔßáÉ Ýí ÇáãæÙÝ áÇäå íÚãá æáÇ íæÌÏáå ÕáÇÍíÉ æÍÇáÊå Ýí ÇáäÙÇã ãæÞÝ¡ æÚáíå íÌÈ ÊÚÏíá ÇáãäÕÈ Ýí ÇáÇÊÕÇáÇÊ ÇáÓÚæÏíÉ', :Global.User, Sysdate, 
                                            :Blk_1.Import_Id, :Blk_1.Import_Date);
    Delete Sale_User_Authority
     Where User_No = Rec6.User_No;

    Delete Sale_User_Authority_Groups
     Where User_No = Rec6.User_No;                                                                                      

    If vn_count7 >= 1 Then
     	Update Sale_Employee_Positions
     	   Set Current_Position     = 0
     	 Where Upper(User_Position) <> Upper(Rec6.User_Position);    	
    	 
     	Update Sale_Employee_Positions
     	   Set Current_Position     = 1
     	 Where Upper(User_Position) = Upper(Rec6.User_Position);
    Else
     	Insert Into Sale_Employee_Positions (User_No, User_Position, Issue_Date, User_Id, System_Date, Current_Position)
     	                             Values (Rec6.User_No, Rec6.User_Position, Sysdate, :Global.User, Sysdate, 1);
    End If;
 End Loop;
--================================================================================================================================================================
 For Rec7 In vc_get_users_data_case8 Loop
  Begin
   Select Count(*)
     Into vn_count8
     From Sale_Employee_Positions
    Where User_No              = Rec7.User_No
      And Upper(User_Position) = Upper(Rec7.User_Position);
   Exception When No_Data_Found Then
  	vn_count8 := 0;
  End;

   Insert Into Rejected_Employee_Positions (User_No, Rejected_Reason, User_Id, System_Date, Import_Id, Import_Date)
                                    Values (Rec7.User_No, 'íæÌÏ ãÔßáÉ Ýí ÇáãæÙÝ áÇäå íÚãá æíæÌÏ áå ÕáÇÍíÉ æÍÇáÊå Ýí ÇáäÙÇã íÚãá æáßä ÇáãäÕÈ ÇáÍÇáí Ýí ÇáäÙÇã íÎÊáÝ Úä ÇáãäÕÈ ÇáÍÇáí Ýí ÇáãáÝ ÇáãÓÊæÑÏ', :Global.User, Sysdate, 
                                            :Blk_1.Import_Id, :Blk_1.Import_Date);
                                            
    Pu_Insert_Authority_Groups_Prc (Rec7.User_No, Rec7.Authority_Code);  -- Refresh The Authority and Groups for User.                                                                                                                                    

    If vn_count8 >= 1 Then
     	Update Sale_Employee_Positions
     	   Set Current_Position     = 0
     	 Where Upper(User_Position) <> Upper(Rec7.User_Position);    	
    	 
     	Update Sale_Employee_Positions
     	   Set Current_Position     = 1
     	 Where Upper(User_Position) = Upper(Rec7.User_Position);
    Else
     	Insert Into Sale_Employee_Positions (User_No, User_Position, Issue_Date, User_Id, System_Date, Current_Position)
     	                             Values (Rec7.User_No, Rec7.User_Position, Sysdate, :Global.User, Sysdate, 1);
    End If;
 End Loop;
--================================================================================================================================================================
 :System.Message_Level := 25;
  Commit;
 :System.Message_Level := 0;
End;


and my progress bar code:

 Set_Item_Property('Progressbar', Width, 0);                                         	
 :Blk_2.Progressbar:='0%';
 Synchronize;
 For I In 1 .. vn_count Loop
 	Set_Item_Property('Progressbar', Width, Round(I * (100 / (vn_count / 514)), 0) * 8);
  :Progressbar := Round(I * (100 / (vn_count / 514)), 0)||'%';-- To Become From 100%
  Synchronize;
 End Loop;
 Pu_Check_Emp_Positions_Prc;


i need to run this progress bar and finished when the procedure finish.

Thank you.

[Updated on: Sun, 11 December 2011 01:15]

Report message to a moderator

Re: Progress bar not working... [message #535051 is a reply to message #535003] Mon, 12 December 2011 01:11 Go to previous messageGo to next message
aallan
Messages: 150
Registered: October 2011
Senior Member
Up..
Re: Progress bar not working... [message #535093 is a reply to message #535051] Mon, 12 December 2011 03:37 Go to previous messageGo to next message
cookiemonster
Messages: 13926
Registered: September 2008
Location: Rainy Manchester
Senior Member
You need to update the progress bar within the above procedure.
You need to work out how far through the procedure you are at various points and reset the progress bar accordingly.
There's no special trick that would allow you to run the progress bar seperately.
Re: Progress bar not working... [message #535096 is a reply to message #535093] Mon, 12 December 2011 03:44 Go to previous messageGo to next message
aallan
Messages: 150
Registered: October 2011
Senior Member
Thats right, but i have no idea how can i do it !!
Thank you.
Re: Progress bar not working... [message #535100 is a reply to message #535096] Mon, 12 December 2011 03:53 Go to previous messageGo to next message
cookiemonster
Messages: 13926
Registered: September 2008
Location: Rainy Manchester
Senior Member
To do it accurately you'd have to work out in advance how many rows each of the 8 cursors is going to return
by doing another query at the start.
Then you work what 1% of the total records is.
Then in each loop you increment a counter to record how many records you've processed so far.
When the counter hits a multiple of 1% call a procedure to add 1% to the progress bar.

Of course all of this will make an already slow procedure even slower.
Personally I'd concentrate on speeding the procedure up so you don't need the progress bar.

[Updated on: Mon, 12 December 2011 03:54]

Report message to a moderator

Re: Progress bar not working... [message #535115 is a reply to message #535100] Mon, 12 December 2011 04:17 Go to previous messageGo to next message
Littlefoot
Messages: 21813
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Or, within each cursor loop, issue a MESSAGE which will inform the end user what it does. For example:
Stage 1/8: collecting data
Stage 2/8: calculating 
...
Stage 8/8: almost finished

Don't forget to SYNCHRONIZE!
Re: Progress bar not working... [message #535134 is a reply to message #535115] Mon, 12 December 2011 05:35 Go to previous messageGo to next message
aallan
Messages: 150
Registered: October 2011
Senior Member
Thamks guys for help,
i really did what Mr.cookiemonster said:

  Select Sum(Rec_Count)
    Into vn_count
    From (
  Select Count(*) Rec_Count
    From Import_Emp_Positions_Dtl A,
         Shows_Users B
   Where A.User_No                      = B.User_No
     And (Substr(A.User_Position, 1, 1) = 'R' Or Substr(A.User_Position, 1, 1) = 'r')
     And A.User_Responsility           Is Not Null
     And B.User_Status                 In (2, 3, 4, 7, 8)
   Union All
  Select Count(*) Rec_Count
    From Import_Emp_Positions_Dtl A,
        Shows_Users B
   Where A.User_No                      = B.User_No
     And (Substr(A.User_Position, 1, 1) = 'R' Or Substr(A.User_Position, 1, 1) = 'r')
     And A.User_Responsility           Is Null
     And B.User_Status                  = 1
   Union All
  Select Count(*) Rec_Count
    From Import_Emp_Positions_Dtl A,
         Shows_Users B
   Where A.User_No                      = B.User_No
     And (Substr(A.User_Position, 1, 1) = 'R' Or Substr(A.User_Position, 1, 1) = 'r')
     And A.User_Responsility           Is Not Null
     And B.User_Status                  = 1
   Union
  Select Count(*) Rec_Count
    From Import_Emp_Positions_Dtl A,
         Shows_Users B
   Where A.User_No                      = B.User_No
     And (Substr(A.User_Position, 1, 1) = 'R' Or Substr(A.User_Position, 1, 1) = 'r')
     And A.User_Responsility           Is Null
     And B.User_Status                 In (2, 3, 4, 7, 8)
   Union
  Select Count(*) Rec_Count
    From Import_Emp_Positions_Dtl A,
         Shows_Users B
   Where A.User_No                      = B.User_No
     And (Substr(A.User_Position, 1, 7) = 'STC_IDS' Or Substr(A.User_Position, 1, 8) = 'STC_HOME'
      Or Substr(A.User_Position, 1, 6)  = 'STC_CE'  Or Substr(A.User_Position, 1, 6) = 'STC_DS')
     And A.User_Responsility           Is Not Null
     And B.User_Status                 In (2, 3, 4, 7, 8)
   Union
  Select Count(*) Rec_Count
    From Import_Emp_Positions_Dtl A,
         Shows_Users B
   Where A.User_No                      = B.User_No
     And (Substr(A.User_Position, 1, 7) = 'STC_IDS' Or Substr(A.User_Position, 1, 8) = 'STC_HOME'
      Or Substr(A.User_Position, 1, 6)  = 'STC_CE'  Or Substr(A.User_Position, 1, 6) = 'STC_DS')
     And A.User_Responsility           Is Null
     And B.User_Status                  = 1
   Union
  Select Count(*) Rec_Count
    From Import_Emp_Positions_Dtl A,
         Shows_Users B
   Where A.User_No                      = B.User_No
     And (Substr(A.User_Position, 1, 7) = 'STC_IDS' Or Substr(A.User_Position, 1, 8) = 'STC_HOME'
      Or Substr(A.User_Position, 1, 6)  = 'STC_CE'  Or Substr(A.User_Position, 1, 6) = 'STC_DS')
     And A.User_Responsility           Is Null
     And B.User_Status                 In (2, 3, 4, 7, 8)
   Union
  Select Count(*) Rec_Count
    From Import_Emp_Positions_Dtl A,
         Shows_Users B
   Where A.User_No                      = B.User_No
     And (Substr(A.User_Position, 1, 7) = 'STC_IDS' Or Substr(A.User_Position, 1, 8) = 'STC_HOME'
      Or Substr(A.User_Position, 1, 6)  = 'STC_CE'  Or Substr(A.User_Position, 1, 6) = 'STC_DS')
     And A.User_Responsility           Is Not Null
     And B.User_Status                  = 1);


may you please write a code toput it in each loop ?
Re: Progress bar not working... [message #535139 is a reply to message #535134] Mon, 12 December 2011 05:51 Go to previous message
cookiemonster
Messages: 13926
Registered: September 2008
Location: Rainy Manchester
Senior Member
It's really simple, pseudo code:
declare

  l_total_count number;
  l_counter number := 0;

begin

  l_total_count := combined total of count selects above;
  
  for rec in cursor1 loop

    l_counter := l_counter + 1;
    <do whatever you do in this loop>
    IF mod(l_counter, (round(l_total_count/100))) = 0 THEN --it's a multiple of 1% of total.
      <call procedure to imcrement the progress bar by 1%>
    END IF;

  END LOOP;

  <repeat for each loop>

END;


Previous Topic: All Block Fields are Disabled
Next Topic: OLE2 updating excel file from Forms question
Goto Forum:
  


Current Time: Wed Jul 10 07:32:59 CDT 2024