Monday, September 17, 2012

Set Field Foreground Color Using Visual Attribute


We had a requirement that based on some conditions we wanted to display Item number in red color as shown below.

We could use oracle provided custom visual attribute and set item instance property to change foreground color as given below.

SET_VA_PROPERTY('CUSTOM5',FOREGROUND_COLOR,'r255g0b0');                          SET_ITEM_INSTANCE_PROPERTY('QUANTITY_FOLDER.ITEM',CURRENT_RECORD,VISUAL_ATTRIBUTE,'CUSTOM5');

Problem we noticed that it takes more time to set the color than to fetch data from database.
To improve the performance instead of using seeded Custom 5 visual attribute  we added new custom visual attribute X_RED_FG. In properties set foreground color to Red. 
Used new custom visual attribute X_RED_FG in set item instance property. This improved performance significantly. We did not used SET_VA_PROPERTY command.

SET_ITEM_INSTANCE_PROPERTY ('QUANTITY_FOLDER.ITEM',CURRENT_RECORD,VISUAL_ATTRIBUTE,'X_RED_FG');


No comments: