Forum Stats

  • 3,722,799 Users
  • 2,244,416 Discussions


Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

change background color of row in oracle forms

User_PA5AU Member Posts: 1


Im using tabular form in oracle forms, which contain 10 columns. 

We created multiple buttons on screen to add, update, delete, duplicate rows in tabular forms. 

I created visual attribute VA_01 to change background color.

<b>I need to change background color of the row which are duplicated, not newly created row. </b>

I tried <b>SET_BLOCK_PROPERTY('PROD_TABLE', CURRENT_RECORD_ATTRIBUTE, 'VA_01');</b> on duplicate button, but it change background color of newly created row as cursor move to next row. I also use <b>SET_ITEM_INSTANCE_PROPERTY(:system.cursor_item, current_record,VISUAL_ATTRIBUTE, 'VA_01');</b> but it is not applying on complete row, it only change color of single column.


  • SFrix
    SFrix Member Posts: 112 Blue Ribbon

    you need to make the set_item_instance_property on all the items of the block that are used to make you list.

    This can be achieved with dynamic code looping on all items of the block and chaging the property of the items displayed on your canvas.

  • SFrix
    SFrix Member Posts: 112 Blue Ribbon
    edited February 16

    Example to loop on block's items

    l_block_name := 'BLOCK_NAME';

     l_item_name := get_block_property (l_block_name, first_item);

    while (l_item_name is not null) loop

         set_item_instance_property (l_block_name ||'.'|| l_item_name, VISUAL_ATTRIBUTE, 'VA_01');

         l_item_name := get_item_property (l_block_name ||'.'|| l_item_name, nextitem);

     end loop;

  • User_PA5AU
    User_PA5AU Member Posts: 1

    unfortunately it isn't working. any other way to do this?

  • Michael Ferrante-Oracle
    Michael Ferrante-Oracle Member Posts: 6,490 Employee

    @User_PA5AU Please explain in details what you mean by "...isn't working...". Also, please include the Forms version you are using. It is very important that you include product versions with all new threads you start.

  • Michael Ferrante-Oracle
    Michael Ferrante-Oracle Member Posts: 6,490 Employee
    edited February 18

    So, using I tested the code suggested by @SFrix and although there is a minor oops in it, the concept works.

    STEP 1:

    Create a Program Unit with code something like this:

    PROCEDURE loop_items (blk_name in varchar2) IS
       item_name varchar2 (30);
       item_name := get_block_property (blk_name, first_item);
       while (item_name is not null) loop
    -- Replace VA1 with the name of your Visual Attribute
          set_item_instance_property (blk_name ||'.'|| item_name, to_number(:SYSTEM.CURSOR_RECORD), VISUAL_ATTRIBUTE, 'VA1');
          item_name := get_item_property (blk_name ||'.'|| item_name, nextitem);
       end loop;

    STEP 2:

    On the Block that contains your multi-record configuration add a WHEN-NEW-RECORD-INSTANCE trigger (maybe in POST-QUERY too) with code something like this. A PU might be better if calling from more than one trigger.

      -- Create your desired IF/THEN. In my example, all occurances of the JOB SALESMAN will be highlighted with my VA1
    END IF;

    Some minor adjustments to the code may be necessary, but the concept should help to get you started. The result will give you something like this:

Sign In or Register to comment.