conditional formatting with forms [message #85097] |
Tue, 01 June 2004 10:55 |
hudo
Messages: 165 Registered: May 2004
|
Senior Member |
|
|
Hello,
I've got a forms-mask displaying the scott.emp table
(tabular style). All records with sal > 1000 should display the value of column sal with the color red,
all others with the color black.
How can I do this ?
Thanks in advance.
|
|
|
Re: conditional formatting with forms [message #85101 is a reply to message #85097] |
Tue, 01 June 2004 14:10 |
Tak Tang
Messages: 142 Registered: May 2004
|
Senior Member |
|
|
There is a procedure 'SET_ITEM_INSTANCE_PROPERTY', that sets the property for the CURRENT ROW/ITEM only. Use this in conjunction with something like POST-SELECT or ON-CHANGE to check for the value, and set the background colour appropriately.
Takmeister
|
|
|
Re: conditional formatting with forms [message #85111 is a reply to message #85101] |
Wed, 02 June 2004 06:48 |
hudo
Messages: 165 Registered: May 2004
|
Senior Member |
|
|
Please can you mail me more details. I tried numerous constellations with SET_ITEM_INSTANCE_PROPERTY and SET_ITEM_PROPERTY on different levels (block/item)..
The only thing that worked was a POST_TEXT_ITEM trigger on the dept-Block level containing:
DECLARE
cur_item VARCHAR2(80);
cur_block VARCHAR2(80) := :SYSTEM.CURSOR_BLOCK;
BEGIN
cur_item := GET_BLOCK_PROPERTY ( cur_block, FIRST_ITEM );
WHILE ( cur_ITEM IS NOT NULL )
LOOP
cur_item := cur_block||'.'||cur_item;
-- here should be an IF-clause: only if the value
-- cur_item > = 20 (just example) then
SET_ITEM_INSTANCE_PROPERTY( cur_item, CURRENT_ROW,VISUAL_ATTRIBUTE,'RED_DATA');
cur_item := GET_ITEM_PROPERTY( cur_item, NEXTITEM);
-- ELSE
NULL;
--END IF;
END LOOP;
END;
This trigger (without the if-clause) marks the WHOLE current record red (wich is defined in VISUAL_ATTRIBUTE named RED_DATA) when the cursor/mouse leaves the actual record in the tabular style. But I want just the values of the column deptno to be displayed red immediately after executing the query, if certain conditions are fulfilled, for example deptno >= 20
Please help
|
|
|
Re: conditional formatting with forms [message #85113 is a reply to message #85111] |
Wed, 02 June 2004 14:20 |
Tak Tang
Messages: 142 Registered: May 2004
|
Senior Member |
|
|
Well done for trying to solve the problem instead of immediately asking for the code - lots of people seem to be too lazy to think!
I am working on Forms 6i patch 13, on windows 2000. I can send you the 'fmt' version if you wish, but it is 78K!
Create a block EMP.
Create a BLOCK TRIGGER 'POST-QUERY' (my previous message which said POST-SELECT was WRONG!)
IF :SAL > 2500 THEN
SET_ITEM_INSTANCE_PROPERTY('SAL', CURRENT_RECORD, VISUAL_ATTRIBUTE , 'BG_RED');
END IF;
Create a visual attribute called 'BG_RED'
with background colour set to red
Kind regards,
Tak
|
|
|
Re: conditional formatting with forms [message #85114 is a reply to message #85113] |
Wed, 02 June 2004 15:05 |
hudo
Messages: 165 Registered: May 2004
|
Senior Member |
|
|
Thanks for the fast reply.
It works now like "it should".
I have another question: I developed the forms with FORMS 6i and they should be handled with the Oracle Application Server 10g.
Is this possible or do I have to create the forms with a newer version of Oracle Forms ??
I never worked with the Oracle AS before.
Are there "special" thinks to keep in mind with such a constellation or does it work straight forward ??
Once again, thanks for the quick answer.
Greetings
|
|
|
Re: conditional formatting with forms [message #85126 is a reply to message #85114] |
Thu, 03 June 2004 06:52 |
Tak Tang
Messages: 142 Registered: May 2004
|
Senior Member |
|
|
I do not have any experience of forms for 9AS or 10AS. I think there are a few things that no longer work due to the move from client/server to web based, but they should be covered in the 'whats new' and 'migration' guides that come with the developer kits.
Takmeister
|
|
|
Re: conditional formatting with forms [message #85136 is a reply to message #85114] |
Fri, 04 June 2004 03:50 |
hudo
Messages: 165 Registered: May 2004
|
Senior Member |
|
|
Now I added another condition to the previous:
all rows with an even row number should have a green background color. I added in the BLOCK TRIGGER 'POST-QUERY':
--IF ( MOD (:DEPTNO,15) = 0 ) THEN
IF ( MOD (:CURRENT_RECORD,2) = 0 ) THEN
--SET_ITEM_INSTANCE_PROPERTY('DEPTNO',CURRENT_RECORD,VISUAL_ATTRIBUTE,'GREEN_BACKGROUND');
SET_BLOCK_PROPERTY('DEPT',CURRENT_ROW_BACKGROUND_COLOR,'green'); --SET_BLOCK_PROPERTY('DEPT',CURRENT_ROW_BACKGROUND_COLOR,'GREEN_BACKGROUND');
END IF;
but by starting the form there occurs an error because of :CURRENT_RECORD in the conditional-clause.
If I used instead the IF -clause containing ( MOD (:DEPTNO,15) = 0 )
the background color for the specific line (deptno = 30) does not change, although I used the SET_BLOCK_PROPERTY command..
Please help
|
|
|