Home » Developer & Programmer » Forms » disable record in data grid at oracle forms
disable record in data grid at oracle forms [message #263538] Thu, 30 August 2007 04:49 Go to next message
ashok_lila
Messages: 9
Registered: April 2006
Location: New Delhi
Junior Member

Hi,

I have an data grid on oracle form and in the there is a field say Status.

I want to disable those line where status is 'Y' other they should be enabled.

Can any one tell me solution. I tried the set_record_property also but its not working.

thanks and regards
Ashok
Re: disable record in data grid at oracle forms [message #263540 is a reply to message #263538] Thu, 30 August 2007 04:54 Go to previous messageGo to next message
Maaher
Messages: 7065
Registered: December 2001
Senior Member
Have you tried SET_ITEM_INSTANCE_PROPERTY?

MHE
Re: disable record in data grid at oracle forms [message #263546 is a reply to message #263540] Thu, 30 August 2007 05:06 Go to previous messageGo to next message
ashok_lila
Messages: 9
Registered: April 2006
Location: New Delhi
Junior Member

Yes I tried with SET_ITEM_INSTANCE_PROPERTY , SET_ITEM_PROPERTY, SET_RECORD_PROPERTY also

ashok
Re: disable record in data grid at oracle forms [message #263552 is a reply to message #263546] Thu, 30 August 2007 05:37 Go to previous messageGo to next message
Maaher
Messages: 7065
Registered: December 2001
Senior Member
Aha! I forgot that the Enabled property cannot be set at instance level... You can, however, set the update_allowed, insert_allowed, visual attribute. That should be good enough. I created a small example form. I'll attach it. It disables the EMPLOYEE records and turns the items gray when the department_id = 50.

Have a look at it. It runs against the demo user 'HR'.

MHE
  • Attachment: orafaq.fmb
    (Size: 56.00KB, Downloaded 2521 times)
Re: disable record in data grid at oracle forms [message #263554 is a reply to message #263552] Thu, 30 August 2007 05:59 Go to previous messageGo to next message
ashok_lila
Messages: 9
Registered: April 2006
Location: New Delhi
Junior Member

Hi

I am getting error while opening form

Encoded program unit has an unknown format

Did you used the old version less then 6I.

Could you pls send me the code which you written in post_query trigger

thanks
Ashok
Re: disable record in data grid at oracle forms [message #263582 is a reply to message #263554] Thu, 30 August 2007 08:01 Go to previous messageGo to next message
Maaher
Messages: 7065
Registered: December 2001
Senior Member
ashok_lila wrote on Thu, 30 August 2007 12:59
Did you used the old version less then 6I.
6i? Do people still use that? It's written in Forms [32 Bit] Version 10.1.2.0.2.

Basically I:
  1. created a block via the block wizard. It's based on HR.EMPLOYEES.
  2. invoked the layout wizard and made the block a multirecord block
  3. added a checkbox (Y/N) just for the fun of having an extra item.
  4. Added an Exit button
  5. Wrote a couple of lines of code. See below.
Here's the content of the PL/SQL code:

WHEN-NEW-FORM-INSTANCE:
Begin
	Execute_Query;
End;
EMPLOYEES.POST-QUERY:
Begin
	If :employees.department_id = 50 THEN
		:employees.chk_test := 'N';
		Disable_Item('employees.chk_test');
		Disable_Item('employees.employee_id');
		Disable_Item('employees.first_name');
		Disable_Item('employees.last_name');
		Disable_Item('employees.department_id');
	End if;
End;
Program unit DISABLE_ITEM
PROCEDURE Disable_Item(p_v_item IN VARCHAR2)
IS
BEGIN
  Set_Item_Instance_Property(p_v_item, current_record, Update_Allowed, Property_False);  
  Set_Item_Instance_Property(p_v_item, current_record, Insert_Allowed, Property_False);
  Set_Item_Instance_Property(p_v_item, current_record, Visual_Attribute, 'VA_DISABLED');
END;
PB_EXIT.WHEN-BUTTON-PRESSED:
Begin
	Exit_Form(No_Validate);
End;
MHE
Re: disable record in data grid at oracle forms [message #263725 is a reply to message #263554] Thu, 30 August 2007 20:45 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
If you want to set attributes for a particular record then do it in the 'pre-record' trigger. For example, turning record level 'delete' 'off'.

David
Re: disable record in data grid at oracle forms [message #263748 is a reply to message #263582] Thu, 30 August 2007 23:36 Go to previous message
ashok_lila
Messages: 9
Registered: April 2006
Location: New Delhi
Junior Member

Thank you very much maheer,

Our application was developed in 6i and still running in this version.

So we have to use the 6i.

Thanks for your kind response, my problem is solved.

thanks again

ashok
Previous Topic: vb.net vs forms
Next Topic: how to make where clause (runtime)
Goto Forum:
  


Current Time: Thu Apr 25 22:46:47 CDT 2024