Visual attibutes problem [message #158459] |
Sat, 11 February 2006 08:29 |
vdsk
Messages: 41 Registered: February 2006 Location: India & UAE
|
Member |
|
|
I want to show negative values for a column in red color in a
Forms 5.0 screen (just like Excel feature).
& I have a post-query trigger as :-
if nvl(:netstock,0) < 0 then set_item_instance_property (':netstock',current_record,visual_attribute,'VA23');
end if;
But it returns a run-time error as :
FRM-41045:Cannot find item:invalid ID
What does this mean ? & How to get result as I want..?
|
|
|
Re: Visual attibutes problem [message #158473 is a reply to message #158459] |
Sat, 11 February 2006 14:22 |
RJ.Zijlstra
Messages: 104 Registered: December 2005 Location: Netherlands - IJmuiden
|
Senior Member |
|
|
Hi,
set_item_instance_property in Forms5 to set a color does not work ( it's a bug, it works in Forms6 )
Use instead:
DISPLAY_ITEM( Item_name, Visual_Attribute );
In your case:
if nvl(:netstock,0) < 0 then
DISPLAY_ITEM(':netstock','VA23');
end if;
HTH,
Regards,
Rob Zijlstra
|
|
|
|
Re: Visual attributes problem [message #158593 is a reply to message #158531] |
Mon, 13 February 2006 06:38 |
vdsk
Messages: 41 Registered: February 2006 Location: India & UAE
|
Member |
|
|
Actually this is a piece of code suggested by another member (Mr Rob) to my issue of Visual attribute problem. Neither I understood it nor it worked for me too. However I got some code for fixing my problm from another member (thanx to LALA).
|
|
|
Re: Visual attibutes problem [message #158624 is a reply to message #158531] |
Mon, 13 February 2006 10:40 |
RJ.Zijlstra
Messages: 104 Registered: December 2005 Location: Netherlands - IJmuiden
|
Senior Member |
|
|
Dear Oracle_Itself,
DISPLAY_ITEM is a builtin used in Forms. It is supported only for backwards compatibility.
You now need to use set_item_instance_property. But the problem is, that in Forms5 this statement does not work. ( It does in Forms6i)
So we need the builtin DISPLAY_ITEM when we want to change 'something' ( in this case the background color) of a specific item.
Picture yourselve a normal block with a number of rows in forms. If you change an attribute in the property sheet on one of these items, the whole column will be changed, and that is sometimes not what we want.
Here the OP wanted to change the color of certain cells based on certain conditions, in his case:
when nvl(:netstock,0) < 0 he wanted to change the backcolor to a backcolor defined in visual attribute named .VA23'.
The way to do this depends:
1) normally you do this in a post-query-trigger on the block.
2) In a post-text-trigger
IF <condition> then
DISPLAY_ITEM( blockname,fieldname, visual attribute)
END IF;
Here it would be
IF nvl(:BLOCKNAME.netstock,0) < 0 then
DISPLAY_ITEM( 'BLOCKNAME.netstock','VA23');
END IF;
(OP did not give blockname)
This works. I used it even today...
One note:
Please use :BLOCKNAME.FIELDNAME and not :FIELDNAME.
As you will find out over the years ( now I'm really feeling old...) this will be a great help when you must debug code.
HTH
Regards,
Rob Zijlstra
|
|
|
|