Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Highlighting a Record based on criteria

Posted on 2004-08-17
6
Medium Priority
?
1,992 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
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

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!

Question has a verified solution.

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

How to Create User-Defined Aggregates in Oracle Before we begin creating these things, what are user-defined aggregates?  They are a feature introduced in Oracle 9i that allows a developer to create his or her own functions like "SUM", "AVG", and…
This post first appeared at Oracleinaction  (http://oracleinaction.com/undo-and-redo-in-oracle/)by Anju Garg (Myself). I  will demonstrate that undo for DML’s is stored both in undo tablespace and online redo logs. Then, we will analyze the reaso…
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.
Via a live example, show how to restore a database from backup after a simulated disk failure using RMAN.

604 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