Home » Developer & Programmer » Forms » Visual attibutes problem
icon5.gif  Visual attibutes problem [message #158459] Sat, 11 February 2006 08:29 Go to next message
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..?

  • Attachment: ITMUL_net.fmb
    (Size: 52.00KB, Downloaded 1186 times)
Re: Visual attibutes problem [message #158473 is a reply to message #158459] Sat, 11 February 2006 14:22 Go to previous messageGo to next message
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 attibutes problem [message #158531 is a reply to message #158473] Mon, 13 February 2006 00:11 Go to previous messageGo to next message
oracle_itself
Messages: 4
Registered: September 2005
Junior Member
DISPLAY_ITEM(':netstock','VA23');
What do you mean with this statment .. can u discuss that with me ?

Oracle ITself
Re: Visual attributes problem [message #158593 is a reply to message #158531] Mon, 13 February 2006 06:38 Go to previous messageGo to next message
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 Go to previous messageGo to next message
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
Re: Visual attibutes problem [message #158627 is a reply to message #158624] Mon, 13 February 2006 10:48 Go to previous message
oracle_itself
Messages: 4
Registered: September 2005
Junior Member
Thanks My Friend For ur Reply and useful Information
Cool
Oracle ITself

[Updated on: Mon, 13 February 2006 10:49]

Report message to a moderator

Previous Topic: Getting windows error during running the sql scripts from form 6i
Next Topic: Forms6i sqlplus.exe try to connect 10Gdatabase
Goto Forum:
  


Current Time: Fri Sep 20 05:48:37 CDT 2024