Home » Developer & Programmer » Forms » [SOLVED] Set_Item_Instance Property - FRM-41384 (Forms [32 Bit] Version 10.1.2.0.2)
[SOLVED] Set_Item_Instance Property - FRM-41384 [message #282275] Wed, 21 November 2007 06:28 Go to next message
Maaher
Messages: 7062
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 #282302 is a reply to message #282275] Wed, 21 November 2007 07:08 Go to previous messageGo to next message
Littlefoot
Messages: 20893
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
As far as I can tell, everything seems to be OK. I tried to create a sample form and used code you wrote - it worked correctly (i.e. no FRM error).

Though, my Forms Builder version is lower than yours (it is [32 Bit] 9.0.4.0.19). Perhaps your version has (an undiscovered) bug?
Re: Set_Item_Instance Property - FRM-41384 [message #282305 is a reply to message #282302] Wed, 21 November 2007 07:16 Go to previous messageGo to next message
Maaher
Messages: 7062
Registered: December 2001
Senior Member
I'll try to create a simple SCOTT.EMP example and post it here.

MHE
Re: Set_Item_Instance Property - FRM-41384 [message #282314 is a reply to message #282305] Wed, 21 November 2007 08:17 Go to previous messageGo to next message
Maaher
Messages: 7062
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
Begin
	NULL;
End;

ON-SELECT
Begin
	NULL;
End;

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:
./fa/3424/0/

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

Re: Set_Item_Instance Property - FRM-41384 [message #282389 is a reply to message #282314] Wed, 21 November 2007 16:43 Go to previous messageGo to next message
Littlefoot
Messages: 20893
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
./fa/1964/0/ I *think* I know what is the problem; it is the fact that if border bevel is set to NONE in item's 'Bevel' property, it can not be modified programmatically. Try to set item's bevel property to 'plain' (for example) and run the form again.

Read more about it in "Border Bevel Property" section in Forms Online Help System.
Re: Set_Item_Instance Property - FRM-41384 [message #282462 is a reply to message #282389] Thu, 22 November 2007 01:13 Go to previous message
Maaher
Messages: 7062
Registered: December 2001
Senior Member
http://www.orafaq.com/forum/fa/1581/0/ Thank you, Littlefoot!I did read the help but I totally missed that part Confused.

I did the following modifications to the form:
canvas background color: white
emp.ename bevel: PLAIN

The Form doesn't generate any errors anymore but I didn't achieve my goal with it. Now, as I would have expected, I can see the border of the item. The whole idea was to make it appear as if the item wasn't there.

Anyway, this issue is resolved but my original problem remains: you cannot "hide" an item through set-item-instance-property. I know several alternatives but I tried to keep it simple.

Thanks again for your insight!

MHE
Previous Topic: How to Play Sound from a Forms
Next Topic: create item at run time
Goto Forum:
  


Current Time: Mon Dec 05 05:08:50 CST 2016

Total time taken to generate the page: 0.18531 seconds