?
Solved

Highlighting a Record based on criteria

Posted on 2004-08-17
6
Medium Priority
?
1,990 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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 2000 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

 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

How to Unravel a Tricky Query Introduction If you browse through the Oracle zones or any of the other database-related zones you'll come across some complicated solutions and sometimes you'll just have to wonder how anyone came up with them.  …
When it comes to protecting Oracle Database servers and systems, there are a ton of myths out there. Here are the most common.
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…
Via a live example, show how to take different types of Oracle backups using RMAN.
Suggested Courses

770 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