Solved

Progress bar or status bar in forms 6i

Posted on 2004-04-19
6
2,958 Views
Last Modified: 2007-12-19
I have one simple form with single button and display item "status".
 suppose  on when button pressed  triggere  iam selecting all the records from emp table and inserting into  other x_emp table having same structure. during this  phenomenon  i mean to say selecting and inserting process i want to show  the user the progress bar  filled with color.(like 10% completed ...20% completed or simply progress bar ) but progress bar should increase  according to transaction means transaction dependent. . Please send me code with description.
0
Comment
Question by:rehman123
6 Comments
 
LVL 6

Expert Comment

by:musdu
Comment Utility
Hi,

you can create a progress bar using a display item with colour. To simulate progress, you can increase length of display item. Assume that you have a proc Progress(pRatio) to do that.

Code behind your button to load emp x_emp table;

DECLARE

  vCount INTEGER;
  i INTEGER := 0;

BEGIN

  SELECT Count(*) INTO vCount
     FROM Emp;

  FOR vRec IN (SELECT * FROM Emp) LOOP

    INSERT INTO x_emp VALUES (
        vRec.Col1, vRec.Col2, ....);

    i := i + 1;

    Progress(ROUND(i/vCount));

  END LOOP;

  COMMIT;

END;
0
 
LVL 22

Expert Comment

by:Helena Marková
Comment Utility
Here is Note:216479.1 from MetLink:

1.  Create  a user defined  parameter PARAM_PERC and datatype Number, Intial value as 0 and maximum value as 30
2.Create  a control block  P_bar below items
  a) P_BAR text item  Datatype char size 200, Bevel  None ,Height 227, Width 11
  b) T_STATUS Display item which displays the % on line
  c) STEP  command button
  d) CLEAR Command button

 Program Unit Clear
  PROCEDURE clear IS
   Begin
     :P_bar.P_bar:='';
     :t_status := '0%';
     :PARAMETER.PARAM_PERC :=0;
  END;

e) prog_bar_step

 PROCEDURE prog_bar_step  IS
   a  number :=:delay;
 begin
  IF :PARAMETER.PARAM_PERC >=0 AND :PARAMETER.PARAM_PERC <=100 THEN
   :p_bar.P_bar:=:p_bar.P_bar||'|';
   :PARAMETER.PARAM_PERC := :PARAMETER.PARAM_PERC +1;
   :t_status := round(:PARAMETER.PARAM_PERC)||'%';
  END IF;
end;

f)  In the STEP command button when button pressed trigger call the procedure  prog_bar_step;
  this will increment the status bar by one step. Depending on the requirement you can call this in any program unit so that it will increment.

ADDITIONAL INFO
If you want to display a progress bar that executes automatically then you can create a timer and put the procedure  prog_bar_step in that. But Timers are not recommended for the Web forms.
0
 

Author Comment

by:rehman123
Comment Utility
can send me code for -----Progress(pRatio) ---
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
LVL 6

Expert Comment

by:musdu
Comment Utility
Henka sent :)
0
 
LVL 47

Expert Comment

by:schwertner
Comment Utility
In many programs such as installer, you will be able to see a boxindicating what percentage of work
has been done while some process is under way.  For example, while running an installer, a bar appears
that indicates how much installation has been done.  Similarly, you
may want to graphically display in Forms how much work has been done while working on something.  For
example, given that you have queried a set of records, suppose you want to visually indicate how many
of all records have been edited as you edit them one by one.  This bulletin provides a procedure that
you can call in an appropriate
trigger to increase the percent completed indication in such a progress bar.  Note that each time you
call this procedure, you will see the bar increasing in length.  You should be responsible for implementing
a scheme or an algorithm that determines when to call this procedure so that it correctly reflects how
much work has been
done.

Implementation
==============
1.  Create a non database block.  In it, create 10 non base table display items.  Make each one look
like a little box, all the same size.  Stack the display items in a line.  Next, put 0% and 100% at
the ends of the arrangement.  You can use Format->Alignment option to
make this easier.  Name those items as I1, I2, I3, ... I10.  You will see something like the following
in the layout editor:
(Below, each letter I represents a display item.)

       --------------------------------
       *    Progress Indicator Bar    *
       *                              *
       *     I I I I I I I I I I      *
       *  0%                     100% *
       --------------------------------

2.  Create 2 visual attributes, V1 and V2.  Give them different attributes.  Now, assign V1 to the above
display items by default. You may want to make V2 so that items with this visual attribute will display
a red background and foreground.

3.  In a When-New-Form-Instance trigger, use this code:

   :global.counter:=1;

4.  Create a Forms procedure called INDICATE with the following code:

   PROCEDURE indicate IS
      i  NUMBER;
   BEGIN
      :global.counter:=TO_CHAR(TO_NUMBER(:global.counter)+1);
      IF :global.counter > 10 THEN
         :global.counter:=1;
         FOR I IN 1..10 LOOP
            SET_ITEM_PROPERTY('i'||to_char(I), VISUAL_ATTRIBUTE, 'V2');
         END LOOP;
         RAISE FORM_TRIGGER_FAILURE;
      END IF;
      SET_ITEM_PROPERTY('i'||TO_CHAR(TO_NUMBER(:global.counter)-1),
         VISUAL_ATTRIBUTE, 'V1');
   END;

5.  In an appropriate trigger, execute INDICATE.  Note that each time you call this procedure, one more
display item will change its color, from V1 to V2.  When all items have changed their color, they will
change their color back to V1.  Therefore, code in your trigger when
to call this PROCEDURE so that it correctly indicates the amount of work that has been done.  See the
example below.

Example
=======
Suppose you have retrieved 10 records in the block and will be editing each record.  Now, you want a
visual indication of how much editing has been done in terms of the number of records.  This is really
simplistic, but it will explain the usage concept.  In this case, you can create a Key-Down trigger
that calls INDICATE.  As you edit each record and go down to the next record, you will see the progress
bar changing its color, properly indicating the amount of work finished.
Likewise, if you have a total of x number of queried records, you can keep a running total of the number
of records edited using a global variable then call INDICATE after you know that a certain percentage
of records have been edited.  You can use the same kind of scheme in a
Post-Query trigger to reflect the total number of records that have been displayed out of the total
records to be fetched.  You can obtain the total by using COUNT_QUERY built-in.
0
 
LVL 8

Accepted Solution

by:
annamalai77 earned 500 total points
Comment Utility
hi there

musdu method is a proven method and a good one to. i have implemented one like that in my application.

regards
annamalai.
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
compre toata in where clue oracle 4 39
sql query 5 51
Oracle -- identify blocking session 24 22
SQL Retrieve Values 4 37
Truncate is a DDL Command where as Delete is a DML Command. Both will delete data from table, but what is the difference between these below statements truncate table <table_name> ?? delete from <table_name> ?? The first command cannot be …
Cursors in Oracle: A cursor is used to process individual rows returned by database system for a query. In oracle every SQL statement executed by the oracle server has a private area. This area contains information about the SQL statement and the…
This video shows syntax for various backup options while discussing how the different basic backup types work.  It explains how to take full backups, incremental level 0 backups, incremental level 1 backups in both differential and cumulative mode a…
This video shows how to copy an entire tablespace from one database to another database using Transportable Tablespace functionality.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now