Home » Developer & Programmer » Forms » multi record block
multi record block [message #117531] Wed, 27 April 2005 17:03 Go to next message
vinodkumarn
Messages: 60
Registered: March 2005
Member
Hi,

I have a multi record block and i do not want the user to click on empty record to insert a record. i want him to always use the ADD button. i want the system to give a message 'Use ADD button to add a record' when he clicks on the empty record. how do i do this

kumar
Re: multi record block [message #118055 is a reply to message #117531] Mon, 02 May 2005 20:09 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
Look at system.last_record in reference manual. In the 'down' key trigger, if it is true raise a failure and the user will be taken back to the last existing record.

David
Re: multi record block [message #118207 is a reply to message #118055] Tue, 03 May 2005 11:54 Go to previous messageGo to next message
vinodkumarn
Messages: 60
Registered: March 2005
Member
NO the problem is, user may click on the empty record by mouse and then try to insert a record. i have to aviod this

i tried creating when mouse click trigger at the block level and wrote the following code

IF Get_Record_Property(:SYSTEM.CURSOR_RECORD,'LOOKUP',STATUS) = 'NEW' THEN
alnum := DISP_ALERT('STOPALERT','Please use "add" button to Add Record');
go_item('ctrl.code');
raise form_trigger_failure;
END IF;
END;

Its working fine, but the problem here is, suppose if i have only 1 record and then if i try to delete that record system says NAME must be entered(i have a code in the save button to check if field NAME is null and stop saving it, if its null)
Re: multi record block [message #118256 is a reply to message #117531] Tue, 03 May 2005 19:45 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
How about defining 'insert' as 'off' in the block properties and only turning it on when they press the 'add' button. You then turn it off again when the record is validated.

2nd answer - Why are you saving if the record is empty? You know if you are at the first record as the row_number is 1. Put a display in your code so that you can see the different status states NEW, INSERT, CHANGED, QUERY as you perform the various operations through your application. You will see the status change as you delete and then add new entries, or the query returns zero rows. Be careful NOT to re-populate a populated field in your post-query trigger as that will cause the status of the record to change causing the inbuild save facility to be activated.

When you turn insert 'ON', you will have to set any mandatory fields to 'themselves' MANUALLY so that their required status is 'activated'.

David

[Updated on: Tue, 03 May 2005 19:53]

Report message to a moderator

Re: multi record block [message #118332 is a reply to message #117531] Wed, 04 May 2005 07:54 Go to previous messageGo to next message
Frank
Messages: 7901
Registered: March 2000
Senior Member
Another question: why do people always try to re-code forms internals? Why do you create your own ADD button? or a SAVE button?
Forms has all these built-in. Use event-triggers to perform the code you use under these buttons!
Redefining Oracles built-ins usually creates trouble, errors and unmaintainable code.

hth
icon14.gif  INSERT_ALLOWED property [message #118374 is a reply to message #117531] Wed, 04 May 2005 15:15 Go to previous message
icemelid
Messages: 15
Registered: April 2005
Location: BARCELONA
Junior Member
Dear Sir

Try to set "INSERT_ALLOWED" property to FALSE on the properties
of the block. This way you disable an empty record to appear at
the end of the block.

Afterwards, add the button 'Use ADD button to add a record', with
the following code:

Set_Block_Property('dept',INSERT_ALLOWED,PROPERTY_TRUE);
Go_Block('Dept');
last_record;

So, you control de addition of records in a programmatic manner.

Hope to help.
Ignasi Cemeli
Previous Topic: Forms Data Connection
Next Topic: :system_record_status
Goto Forum:
  


Current Time: Thu Sep 19 18:09:29 CDT 2024