Solved

Highlighting a Record based on criteria

Posted on 2004-08-17
6
1,968 Views
Last Modified: 2008-01-09
Right now I have some criteria that will change the background color of an Item within a record.  But right now it will change the color of all the items, no matter what record it is.

Here is what I need to do - I have 3 records displayed (with a scrollbar if more items exist) in a column style.  Meaning that record 1 is column 1, and record 2 is column 2, etc.  Right now I find if A>B then change the background color of Field1.  This will change the color of Field1 in all the records:

SET_ITEM_PROPERTY('Field1', VISUAL_ATTRIBUTE, 'BACKGROUND_YELLOW');

I would like to change the color of all the items in Record1, but not in Record2.  Can this be done?  and if so can someone get me started on the right track?
0
Comment
Question by:Intern
  • 3
  • 2
6 Comments
 
LVL 15

Expert Comment

by:andrewst
ID: 11825015
The built-in you need is SET_ITEM_INSTANCE_PROPERTY.  That only changes the properties on specified row.
0
 
LVL 5

Expert Comment

by:FBIAGENT
ID: 11825032
You should be able to use built-in function

 SET_ITEM_INSTANCE_PROPERTY('<block_name>.Field1', <record_number>, VISUAL_ATTRIBUTE, 'BACKGROUND_YELLOW');

<record_number> is the record number within the block
0
 
LVL 1

Author Comment

by:Intern
ID: 11825400
FBIAGENT - Thanks that helped some.

I have a couple more questions that I need to answer to get this to work correctly.

First - I need to loop through the items in that particular record and change the background for all of them.  What is the best way to do this?  I could hard-code each item, but that is not exactly "good" programming style.

Secondly - What property or value can I use to find out the current record? (i.e. <record_number>)  I am not sure how I can programmable find this value.
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 5

Expert Comment

by:FBIAGENT
ID: 11825514
"First - I need to loop through the items in that particular record and change the background for all of them.  What is the best way to do this?  I could hard-code each item, but that is not exactly "good" programming style."

I would put the logic to change the record attribute in the block-level POST-QUERY trigger, and appropriate item-level WHEN-VALIDATE-ITEM triggers

"Secondly - What property or value can I use to find out the current record? (i.e. <record_number>)  I am not sure how I can programmable find this value."

If you put the SET_ITEM_INSTANCE_PROPERTY() in the POST-QUERY and WHEN-VALIDATE-ITEM triggers, then the <record_number> is :system.trigger_record
0
 
LVL 1

Author Comment

by:Intern
ID: 11825609
Thanks - I just need a little clarification on the First point

- If I have 3 items - BLOCK.Field1, BLOCK.Field2, BLOCK.Field3

How do I create a loop that will loop through all the fields in that block.  I know where to put the code, just not sure of the syntax on how to do it.
0
 
LVL 5

Accepted Solution

by:
FBIAGENT earned 500 total points
ID: 11826105
You could simply do

set_item_instance_property('block.field1',:sytem.trigger_record,visual_attribute,'background_yellow');
set_item_instance_property('block.field2',:sytem.trigger_record,visual_attribute,'background_yellow');
set_item_instance_property('block.field3',:sytem.trigger_record,visual_attribute,'background_yellow');

or loop through all items in the block as follows

declare
   blk_name                           varchar2(30) := 'BLOCK';
   block_handle                       block;
   block_current_item                 varchar2(30);
   block_last_item                    varchar2(30);
   error_msg                          varchar2(255);
   item_handle                        item;
begin
   -- set up for loop to traverse all the items in the block

   block_handle := find_block(blk_name);
   block_current_item := get_block_property(block_handle, first_item);
   block_last_item := get_block_property(block_handle, last_item);

   -- loop to traverse every item in the block
   loop
      -- verify that the item exists
      item_handle := find_item(blk_name || '.' || block_current_item);

      -- set attribute of the item if condition satisfies
      if ... then
         set_item_instance_property(item_handle,:system.trigger_record,visual_attribute,'BACKGROUND_YELLOW');
      end if;

      -- at end of loop either go to the next item or end looping if at the
      -- last item in this block
      exit when block_current_item = block_last_item;
      block_current_item := get_item_property(item_handle, nextitem);
   end loop;
end;
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

Article by: Swadhin
From the Oracle SQL Reference (http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/queries006.htm) we are told that a join is a query that combines rows from two or more tables, views, or materialized views. This article provides a glimps…
Working with Network Access Control Lists in Oracle 11g (part 1) Part 2: http://www.e-e.com/A_9074.html So, you upgraded to a shiny new 11g database and all of a sudden every program that used UTL_MAIL, UTL_SMTP, UTL_TCP, UTL_HTTP or any oth…
This video explains at a high level about the four available data types in Oracle and how dates can be manipulated by the user to get data into and out of the database.
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…

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

23 Experts available now in Live!

Get 1:1 Help Now