Home » Developer & Programmer » Forms » code for insert,execute,delete records (forms6i,winxp)
code for insert,execute,delete records [message #313157] Thu, 10 April 2008 23:08 Go to next message
gemini5
Messages: 16
Registered: April 2008
Junior Member
Hi,
I have a question here.I wanted to know if we can have buttons for inserting,executing and addition and deletion of records and these buttons should be common for all the data blocks on the form.
Like for eg:-I have a form that has 4 data blocks like project,proj_dev_cost,proj_requirement and products.there is a master detail relationship between project and proj_dev_cost.Now wat i want is buttons for addition,deletion,execution buttons common for all data blocks.is that possible?? and if yes can anyone please provide me the code for the buttons....I need it urgently.... Sad
Re: code for insert,execute,delete records [message #313162 is a reply to message #313157] Thu, 10 April 2008 23:43 Go to previous messageGo to next message
Littlefoot
Messages: 20901
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
I don't have Developer Suite 6i to check it, but I believe that it must exist there as well as in 10g.

So: if "Menu module" form property is set to "DEFAULT&SMARTBAR", form will - by default - contain these buttons. Here is a 10g screenshot - verify that it exists (or not) in 6i as well.

./fa/4132/0/

icon9.gif  Re: code for insert,execute,delete records [message #313163 is a reply to message #313157] Thu, 10 April 2008 23:52 Go to previous messageGo to next message
gemini5
Messages: 16
Registered: April 2008
Junior Member
Thanx Sir,
That defualt bar does exist in forms 6i also but when i click on the execute option on that bar it will execute only the first two data block queries as there is master-detail relationship between them.I need to the place my cursor on the proj_requirement and then click on execute again to get the records displayed in that block n again do the same for products data block also...i dont want to keep doin that...so i wanted a single button for execute so that when i click on it....all the records for all the data blocks will be displayed at once......plzzz help me with this...is this possible??or do i need to create separate button for each data block
Re: code for insert,execute,delete records [message #313173 is a reply to message #313163] Fri, 11 April 2008 00:10 Go to previous messageGo to next message
Littlefoot
Messages: 20901
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
I see; well, you might create a button an put something like this in there:
GO_BLOCK('first_block');
EXECUTE_QUERY;

GO_BLOCK('second_block');
EXECUTE_QUERY;

GO_BLOCK('third_block');
EXECUTE_QUERY;
Re: code for insert,execute,delete records [message #313244 is a reply to message #313157] Fri, 11 April 2008 03:57 Go to previous messageGo to next message
gemini5
Messages: 16
Registered: April 2008
Junior Member

Smile That worked perfectly fine...i really appreciate your help Sir.
I have created buttons for insert,exit,next and previous record.but i dont know wat code should i write for the delete button....could u please give me an idea of how i could go about it...wat should be the code for the delete record button
Re: code for insert,execute,delete records [message #313249 is a reply to message #313244] Fri, 11 April 2008 04:11 Go to previous messageGo to next message
Littlefoot
Messages: 20901
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
First of all, you'll have to take care about master-detail (parent-child / referential integrity) constraints. First delete children, then parents.

Depending on what you'd like to do, you might use DELETE_RECORD built-in (which would delete a record on the screen), or code DELETE SQL statement and delete desired records from the table using appropriate WHERE clause (such as ... WHERE id = :form_block.id).
Re: code for insert,execute,delete records [message #313259 is a reply to message #313157] Fri, 11 April 2008 04:51 Go to previous messageGo to next message
gemini5
Messages: 16
Registered: April 2008
Junior Member
okk..i will take care of the master-detail relationship.
but now wat i want to do is...if i place my cursor on any record of any block and press the delete button..that record should get deleted if it is a child...or else if it is the parent record that shud show an appropriate message...could you plzz give me the code for it..i have mentioned the data blocks that i am using in the first question....i tried delete_record..but again i need to put this in every data block separately...n i dont want to do that...kindly help me with this...thank you
icon9.gif  Re: code for insert,execute,delete records [message #313302 is a reply to message #313157] Fri, 11 April 2008 06:17 Go to previous messageGo to next message
gemini5
Messages: 16
Registered: April 2008
Junior Member
Can anyone help me with this issue??pllzz i need to find a solution urgently
Re: code for insert,execute,delete records [message #313587 is a reply to message #313259] Sun, 13 April 2008 19:43 Go to previous messageGo to next message
djmartin
Messages: 10180
Registered: March 2005
Location: Canberra ACT Australia
Senior Member
Account Moderator
Then write a trigger at the form level, test the 'system.current_block', and if appropriate delete the record.

David
Re: code for insert,execute,delete records [message #313882 is a reply to message #313302] Tue, 15 April 2008 00:43 Go to previous messageGo to next message
varosh81
Messages: 178
Registered: February 2008
Location: CHENNAI
Senior Member
insert : commit;

delete on-delete in form level trigger
Re: code for insert,execute,delete records [message #313904 is a reply to message #313157] Tue, 15 April 2008 02:15 Go to previous messageGo to next message
gemini5
Messages: 16
Registered: April 2008
Junior Member
I am sorry for asking such questions but i dint get wat u want me to do exactly...like u have said i would need to have a form level trigger n check it as per system.current_block...but would this be in an 'on-delete' trigger at form level??But then would i not need a button for delete n a when-button-pressed trigger for that button??How with the help of the form-level trigger will i be able to delete records??kindly explain Sad ...m confused
Re: code for insert,execute,delete records [message #315538 is a reply to message #313904] Mon, 21 April 2008 20:25 Go to previous message
djmartin
Messages: 10180
Registered: March 2005
Location: Canberra ACT Australia
Senior Member
Account Moderator
Have you solved your problem? Read the reference manual or online help concerning the 'on-delete' trigger.

In your 'when-button-pressed' trigger, test to find out where the cursor is currently placed, then use that information to determine the block to which you need to point and then use 'delete_record' to delete the record.

David
Previous Topic: Hide username and password in URL
Next Topic: query performance
Goto Forum:
  


Current Time: Fri Dec 09 19:27:00 CST 2016

Total time taken to generate the page: 0.05974 seconds