• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 4444
  • Last Modified:

Visual Attributes in Oracle Forms 5

I have got a multi record block displayed. Each record has an attribute for Status, there are different Statuses eg, REQUESTED, ASSOCIATED, ASSIGNED, etc...

What I want to do is somehow when Oracle Forms retrives the records for them to be displayed in the block in different colours depending upon the status, eg, all rows with status of REQUESTED should be RED, ASSOCIATED should be YELLOW, etc...

I have written the following code to achieve this but everytime I issue a NEW_BLOCK command it takes a couple of seconds for it to process the code as I feel it is very long winded...

Does anyone know of an easier and more efficient way of doing this??

Here is what I have written:

I have 3 Visual Attribute colours; RED, YELLOW AND GREEN

-- this procedure loops through the block starting at the topmost record and then working down and setting each item's colour in the record. It calls another Procedure to actually set the colour of an item according to the Status.

PROCEDURE SET_STATUS_COLOURS IS

  TOP_MOST_RECORD NUMBER;
  BOTTOM_MOST_RECORD NUMBER;

BEGIN


  TOP_MOST_RECORD := GET_BLOCK_PROPERTY('CHANGES', TOP_RECORD);

  LAST_RECORD;

  BOTTOM_MOST_RECORD := GET_BLOCK_PROPERTY('CHANGES', CURRENT_RECORD);

  FIRST_RECORD;

    -- Loop through from top to bottom and set each row's colour

    FOR THIS_REC IN TOP_MOST_RECORD..BOTTOM_MOST_RECORD LOOP

       Set_Row_Color_Attributes (:CHANGES.STATUS,
                                 THIS_REC,
                                 'CHANGES.CHANGE_ID');

       Set_Row_Color_Attributes (:CHANGES.STATUS,
                                 THIS_REC,
                                 'CHANGES.STATUS');

           NEXT_RECORD;

    END LOOP;

  END IF;

 
  First_Record;



END;


-- sets the an item's colour property. So this Procedure is called for every field in every row.

PROCEDURE Set_Row_Color_Attributes (IN_STATUS IN VARCHAR2,
                                    IN_ROW_COUNT IN NUMBER,
                                    IN_COLUMN_NAME IN VARCHAR2) IS

BEGIN

       

          IF IN_STATUS = 'REQUESTED' THEN
            SET_ITEM_INSTANCE_PROPERTY(IN_COLUMN_NAME, IN_ROW_COUNT, VISUAL_ATTRIBUTE, 'RED');
          END IF;
         
          IF IN_STATUS = 'ASSOCIATED' THEN
            SET_ITEM_INSTANCE_PROPERTY(IN_COLUMN_NAME, IN_ROW_COUNT, VISUAL_ATTRIBUTE, 'YELLOW');
          END IF;

          IF IN_STATUS = 'ASSIGNED' THEN
            SET_ITEM_INSTANCE_PROPERTY(IN_COLUMN_NAME, IN_ROW_COUNT, VISUAL_ATTRIBUTE, 'GREEN');
          END IF;

         
END;

What I need is someway of actually processing the whole row in one go rather than each individual item at a time... is there anyway to do this?? Am I missing some really basic means of doing this?? Please can someone help???

Much appreciated...

Regards,

Pardeep (BT Software Engineer)
0
pardeep_nagra
Asked:
pardeep_nagra
  • 8
  • 7
1 Solution
 
pardeep_nagraAuthor Commented:
Urgently needed answer... thanks..
0
 
SrinivasKCommented:
HI
You have to write this code in the POST-QUERY trigger of the CHANGES block.

         IF :STATUS = 'REQUESTED' THEN
            SET_ITEM_INSTANCE_PROPERTY(:CHANGE_ID,                                 CURRENT_RECORD, VISUAL_ATTRIBUTE,
              'RED');
         END IF;
                             
         IF :STATUS = 'ASSOCIATED' THEN
             SET_ITEM_INSTANCE_PROPERTY(:CHANGE_ID,                                   CURRENT_RECORD, VISUAL_ATTRIBUTE,
                 'YELLOW');
         END IF;

         IF :STATUS = 'ASSIGNED' THEN
              SET_ITEM_INSTANCE_PROPERTY(:CHANGE_ID,                                  CURRENT_RECORD, VISUAL_ATTRIBUTE,
                 'GREEN');
         END IF;

This should work coz whenever u enter the block, for each record queried post query trigger fires.
Regs,
Srinivas K
0
 
pardeep_nagraAuthor Commented:
(( Srinivask ))

I tried out what you suggested and it worked... thanks !!!

But I have one small problem, when I click on a record in the multi row block I want it to highlight a different colour... and then when I click on another record I want it to go back to it's original colour before I highlighted it...

I tried using set_item_instance procedure but it highlights every record I click on and doesn't send them to their original colour after I have clicked another one...

Basically I wanted to highlight the record I am currently selecting...

Would you know how to do this??

I tried a Pre-record trigger but I cannot workout the best way of doing this...

waiting eagerly for your reply... thanks...

Regards,

Pardeep
0
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 
SrinivasKCommented:
For this you can use the property "current record visual attribute group" for the block, if you want all items in the block to get highlighted or for the item if you want specific items to get highlighted when you are on it.

let me know whether this is ok with you.

thanks
Srinivas k
0
 
pardeep_nagraAuthor Commented:
((Srinivas K))

I tried using that property you suggested before but what happens is that when I click a record it highlights it as I want... but then when I click another record, the new record also gets highlighted which is what I want... but the previous record I clicked on should now go back to its original colour and not stay the colour of selectd records... as this functionality would turn all records to he same colour... and this is not what I want to achieve...

do you get what I mean?? I know it sounds confusing but it's not...

Basically I just want the current record selected to turn to a different colour...

Could you possibly give me some sample code to achieve this?? I'm really desparate as I have a deadline soon...

Much appreciated,

Pardeep
0
 
SrinivasKCommented:
i have a question
do you have two different valus for the properties
1.visual attribute group
2.current record visual attribute group

if you have two different values for these properties, then
when you on a particular record its color will be that defined by "current record visual attribute group" and all other records will have colors defined by their  "visual attribute group " property.

just check this.Also may be u have some code previously which is causing this problem that the color of unselected records remaining with selected color.
if possible u can send ur fmb file as attachment to my mail id
onapriya@mailcity.com.

thanks,
Srinivas K
0
 
pardeep_nagraAuthor Commented:
Srinivas

I have sent you the FMB...

Regards,

Pardeep
0
 
SrinivasKCommented:
i didn't get any mail at all.
regs,
Srinivas K
0
 
pardeep_nagraAuthor Commented:
Srinivas, what is your full email address... is it: onapriya@mailcity.com
           or: apriya@mailcity.com ??
0
 
SrinivasKCommented:
its the first one.
r u still having problems ?
regards,
Srinivas K
0
 
SrinivasKCommented:
its the first one.
r u still having problems ?
regards,
Srinivas K
0
 
pardeep_nagraAuthor Commented:
Yes I am still having probems.. I have sent u the Form.. let me know if u got it... thanks...


0
 
SrinivasKCommented:
In the file you've sent, there is no visual attribute associated with the "current record visual attribute group " property of the 'CHANGES' block.
I am not able to make out where you are going wrong.
If you set the "current record visual attribute group " property of the 'CHANGES' block to some color other than the color for the property "visual attribute group " then the form should behave the way you wanted.
Just try again, it should work.
Regards,
Srinivas K
0
 
crsankarCommented:
Can you please send me the fmb file. I can do this for you the way you want it.

0
 
pardeep_nagraAuthor Commented:
Hi crsankar,

I don't have ur email address... could you send me your email address?? Then I will send you the FMB file...

Thanks...
0
 
pardeep_nagraAuthor Commented:
Thank u all... you've been great !!!
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 8
  • 7
Tackle projects and never again get stuck behind a technical roadblock.
Join Now