Link to home
Start Free TrialLog in
Avatar of Intern
Intern

asked on

Highlighting a Record based on criteria

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?
Avatar of andrewst
andrewst

The built-in you need is SET_ITEM_INSTANCE_PROPERTY.  That only changes the properties on specified row.
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
Avatar of Intern

ASKER

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.
"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
Avatar of Intern

ASKER

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.
ASKER CERTIFIED SOLUTION
Avatar of FBIAGENT
FBIAGENT

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial