[SOLVED] Set_Item_Instance Property - FRM-41384 [message #282275] |
Wed, 21 November 2007 06:28 |
|
Maaher
Messages: 7065 Registered: December 2001
|
Senior Member |
|
|
FACTS
* Forms [32 Bit] Version 10.1.2.0.2
* Block MY_BLOCK is a multirecord block based on transactional triggers.
* Item MY_BLOCK.MY_ITEM has border bevel NONE
GOAL
Set the bevel of an item LOWERED if a record is fetched. I am asked to do this to hide the instances of an item that are not filled by the ON-FETCH transactional trigger.
WHAT I TRIED
In the post-query I have the following code:
Declare
v_n_rowno NUMBER;
Begin
v_n_rowno := TO_NUMBER(Get_Block_Property('MY_BLOCK', CURRENT_RECORD));
Set_Item_Instance_Property( 'MY_BLOCK.MY_ITEM', v_n_rowno, BORDER_BEVEL, LOWERED);
End; This code compiles well, but at runtime I get:FRM-41384 : Invalid parameter used for Set_Item_Instance_Property Metalink nor Google showed me where I went wrong. Any ideas?
A colleague had the same issue and solved it by fiddling with a stacked canvas he placed on top of the records that were empty. I rather try something else.
MHE
[Updated on: Thu, 22 November 2007 01:14] Report message to a moderator
|
|
|
|
|
Re: Set_Item_Instance Property - FRM-41384 [message #282314 is a reply to message #282305] |
Wed, 21 November 2007 08:17 |
|
Maaher
Messages: 7065 Registered: December 2001
|
Senior Member |
|
|
Ok, here it is.
I connected to a SCOTT sample schema.
I created a block 'EMP' manually.
I changed the block properties INSERT/UPDATE/DELETE allowed to NO.
I changed the Query data source type property to 'transactional triggers'
Then I added 2 items:
ename (varchar2(30)) - I set the bevel to "None"
sal (number)
I created a basic layout using the layout wizard: tabular layout, 7 records displayed, ...
Next, I created an exit button BT_EXIT in the block with the following code in the WHEN-BUTTON-PRESSED trigger:
BEGIN
EXIT_FORM(NO_VALIDATE);
END;
I placed the button on the canvas and changed the property of number of records displayed to 1.
Here is the code:
One package specification:
PACKAGE EMP_QUERY IS
TYPE t_r_emp IS RECORD ( ename VARCHAR2(30), sal NUMBER);
TYPE t_t_emp IS TABLE OF t_r_emp INDEX BY BINARY_INTEGER;
v_t_emp t_t_emp;
v_n_rownum PLS_INTEGER;
END;
Form level triggers:
WHEN-NEW-FORM-INSTANCE:
Begin
GO_BLOCK('EMP');
EXECUTE_QUERY;
End;
Block level triggers (emp):
ON-LOCK
ON-SELECT
ON-FETCH:
Begin
IF emp_query.v_n_rownum < emp_query.v_t_emp.COUNT
THEN
emp_query.v_n_rownum := emp_query.v_n_rownum + 1;
Create_Queried_Record;
:EMP.ename := emp_query.v_t_emp(emp_query.v_n_rownum).ename;
:EMP.sal := emp_query.v_t_emp(emp_query.v_n_rownum).sal;
END IF;
End;
PRE-QUERY:
Begin
FOR rec in ( SELECT ename, sal FROM emp )
LOOP
emp_query.v_n_rownum := 0;
emp_query.v_t_emp(emp_query.v_t_emp.count+1).ename := rec.ename;
emp_query.v_t_emp(emp_query.v_t_emp.count).sal := rec.sal;
END LOOP;
End;
POST-QUERY:
Declare
v_n_current PLS_INTEGER;
Begin
v_n_current := TO_NUMBER(Get_Block_Property('EMP', CURRENT_RECORD));
IF MOD(emp_query.v_n_rownum, 2 ) = 0 THEN
Set_Item_Instance_Property('EMP.ENAME', v_n_current, BORDER_BEVEL, LOWERED);
END IF;
End;
When I run it I get:
In attach you'll find the form I used.
[edit]An additional note: The form of our application is compiled on Unix and the EMP test form on Windows. The both have the same problem.
MHE
[Updated on: Wed, 21 November 2007 08:25] Report message to a moderator
|
|
|
|
|