Home » Developer & Programmer » Forms » Do You Want to Save...
Do You Want to Save... [message #149163] Wed, 30 November 2005 07:02 Go to next message
Shaila.Mehra
Messages: 88
Registered: July 2005
Location: mumbai
Member

Hi everyone.
The message::
" Do You Want To Save The Changes You Have Made ?"When i press the button which query the records then this message comes with record and there are many more conditions where i faced this message.
And when i press NO option then it remove the message otherwise if i press the YES option it saves the record.
Third oion is NO.

So for gertting rid of this should i have to disable the insert property while query.
pls send me some tip to override this message.

Shaila.
Re: Do You Want to Save... [message #149176 is a reply to message #149163] Wed, 30 November 2005 07:59 Go to previous messageGo to next message
kiran
Messages: 503
Registered: July 2000
Senior Member
Check the block status , if it is "CHANGED" just commit the form using COMMIT or POST.

--Kiran.
Re: Do You Want to Save... [message #149177 is a reply to message #149163] Wed, 30 November 2005 08:01 Go to previous messageGo to next message
Maaher
Messages: 7062
Registered: December 2001
Senior Member
First of all, you should know why you get this message. Does this message also occur without you having changed anything manually?

It means your record status has been changed, i.e. some field in the form has been changed either with or without your knowledge.

I'd say, check your post-query trigger. It is very often that the problem lies in there. Are there any database fields being updated there. If so, and they shouldn't be saved, set the record status property to QUERY_STATUS.

MHE
Re: Do You Want to Save... [message #150049 is a reply to message #149163] Tue, 06 December 2005 01:44 Go to previous messageGo to next message
djmartin
Messages: 10180
Registered: March 2005
Location: Canberra ACT Australia
Senior Member
Account Moderator
Have you solved your problem?

David
Re: Do You Want to Save... [message #150131 is a reply to message #150049] Tue, 06 December 2005 08:26 Go to previous messageGo to next message
Shaila.Mehra
Messages: 88
Registered: July 2005
Location: mumbai
Member

I am attaching this .fmb(Scott's schema).
This is just an example here when i press the button it donot make any query. It wants a value to be entered first for query.

And when i give the value and press button then it again show that message about which we discussed earlier.

So how do i query the record by pressing the button.

Shaila.

  • Attachment: Error.fmb
    (Size: 48.00KB, Downloaded 679 times)
Re: Do You Want to Save... [message #150253 is a reply to message #150131] Tue, 06 December 2005 22:49 Go to previous messageGo to next message
djmartin
Messages: 10180
Registered: March 2005
Location: Canberra ACT Australia
Senior Member
Account Moderator
Help me out here. I don't have forms available to me but working through an intelligent flat file editor I believe that you have the following code in your form.

POST-QUERY (EMP)
BEGIN
  :dates := SYSDATE;
END;
WHEN-BUTTON-PRESSED (EMP.PUSH_BUTTON5)
BEGIN
  Go_block('emp');
  
  execute_query;
  
  IF :system.form_status = 'changed' THEN
    COMMIT;
  END IF;
END;

What is happening is that EVERY record that is retrieved is having its 'dates' field updated, the status will be set to 'CHANGED', and you are asking the form to 'commit'.

Now before we start correcting your code there are three things you SHOULD be doing.
1) ':dates' should be ':emp.dates' - ALWAYS specify block and item.
2) When testing Oracle defined values ALWAYS do them in upper case. So 'changed' should be 'CHANGED'.
3) In a Form use Commit_Form. It you want a commit done AND DONE NOW IRRESPECTIVE of the status of a form then use 'Standard.Commit'.

If you want Emp.Dates initialised to 'sysdate' then define the default value of Emp.Dates to '$$DATE$$' or '$$DATETIME$$'. If you want Emp.Dates to be updated when the record is changed then do it in a database trigger.

Okay, now remove the Post-Query trigger, remove the form_status code IF statement from the push_button, do a Ctrl-Shft-K (compile all), then a Ctrl-T (generate) and try you program again.

Tell us what extra behaviour you want from your form and we will help you with it.

David
Re: Do You Want to Save... [message #150353 is a reply to message #150253] Wed, 07 December 2005 08:33 Go to previous messageGo to next message
Shaila.Mehra
Messages: 88
Registered: July 2005
Location: mumbai
Member

Thanks for giving reply..
Now this time when i ran my form no item is updated and still i am getting same message.

It first needs a value for query and when the button pressed it retrieves records.

But i want that only by pressing a button it retrieves records.

Can you tell me more about the 'Standard.Commit'.

Shaila.
  • Attachment: Error.fmb
    (Size: 48.00KB, Downloaded 447 times)
Re: Do You Want to Save... [message #150432 is a reply to message #150353] Wed, 07 December 2005 19:15 Go to previous messageGo to next message
djmartin
Messages: 10180
Registered: March 2005
Location: Canberra ACT Australia
Senior Member
Account Moderator
Okay. Now you have:

WHEN-BUTTON-PRESSED (EMP.CLEAR)
CLEAR_FORM;
and WHEN-BUTTON-PRESSED (EMP.PUSH_BUTTON5)
EXECUTE_QUERY;
Do you have any 'initial values' set?

David
Re: Do You Want to Save... [message #151064 is a reply to message #149176] Mon, 12 December 2005 23:43 Go to previous messageGo to next message
Scarlet.Zhu
Messages: 22
Registered: December 2005
Location: Shanghai
Junior Member

kiran wrote on Wed, 30 November 2005 07:59

Check the block status , if it is "CHANGED" just commit the form using COMMIT or POST.

--Kiran.



FUNCTION GET_BLOCK_PROPERTY
(block_id Block,
property NUMBER);
FUNCTION GET_BLOCK_PROPERTY
(block_name VARCHAR2,
property NUMBER);

Do these functions above retrieve block status???

Thanks!
Scarlet
Re: Do You Want to Save... [message #151216 is a reply to message #151064] Tue, 13 December 2005 16:15 Go to previous messageGo to next message
djmartin
Messages: 10180
Registered: March 2005
Location: Canberra ACT Australia
Senior Member
Account Moderator
You can get the current block status using System.Block_Status and the status of any block ('blk') using Get_Block_Property('blk',STATUS).

David
Re: Do You Want to Save... [message #275909 is a reply to message #151064] Tue, 23 October 2007 05:59 Go to previous messageGo to next message
unthirudan
Messages: 3
Registered: July 2007
Location: India
Junior Member
Hi...

I wannna know what will the POST statement do... If i delete a record from the current block on screen, and wanna undo this operation.. i.e., i wanna rollback, or undo the delete operation...

Here should i use the POST statement..... Or anything else...

Bcze if i use the COMMIT or COMMIT_FORM the delete record will be saved in the database... How to undo this delete operation...

I have put a button and added the following script
DELETE_RECORD when the button is pressed....

I have kept another button to cancel this delete record....

Pls Help...
Valentine M
Re: Do You Want to Save... [message #276080 is a reply to message #275909] Tue, 23 October 2007 19:45 Go to previous messageGo to next message
djmartin
Messages: 10180
Registered: March 2005
Location: Canberra ACT Australia
Senior Member
Account Moderator
POST is similar to COMMIT (database triggers fire, constraints are tested) but a ROLLBACK will undo ALL changes since the last SAVEPOINT was issued, not just the last command that you issued.

If you want to be able to select which record to delete and undelete then consider adding an 'operation' column/item to the record. Then, on a 'delete', mark it with a 'D'. Then when you 'SAVE' your changes, you run a 'delete' statement which will physically delete all records marked with a 'D'. To undo the 'delete' (before the 'SAVE' is run) you would just remove the 'D' from the 'operation' column.

David

PS Please use 'want to' instead of 'wanna'.
Re: Do You Want to Save... [message #302048 is a reply to message #149163] Fri, 22 February 2008 16:00 Go to previous messageGo to next message
marvSQL
Messages: 13
Registered: February 2008
Location: JAMAICA
Junior Member
i have a similar problem.i am new to oracle developement.
i have form with a master-detail relationship.

tables involved are:
--------------------------
department --being the master
employee --being the detail table


i have attached the form for viewing.

i attached an l-o-v to fill the department fields.
what i wanted was that each tim that i change the department via the l-o-v a listing of all employees under that department is to be shown.
but each time i select a new department using the l-o-v the message(Do You Want To Save The Changes You Have Made ) comes up.how can i suppress this message?
Re: Do You Want to Save... [message #302215 is a reply to message #302048] Sun, 24 February 2008 22:55 Go to previous messageGo to next message
djmartin
Messages: 10180
Registered: March 2005
Location: Canberra ACT Australia
Senior Member
Account Moderator
Are you making any changes to your records or do you believe that this message is being raised in error?

David
Re: Do You Want to Save... [message #302222 is a reply to message #302048] Sun, 24 February 2008 23:33 Go to previous messageGo to next message
sasipalarivattom
Messages: 118
Registered: June 2007
Location: Cochin ( INDIA )
Senior Member

Dear Marvy,
The problem is because your LOV assigns values to DEPARTMENT_ID and DEPARTMENT_NAME fields.
as the values are assigned to the fields, block status will be modified as 'CHANGED' .
Since it is a datablock, it will ask you wether to save this new values.

Now what you have to do is simple.

1. Create a parameter DEPTID to save the department_id (primary key).
2. In the LOV ,change the return value of deparment_id to this parameter.
3. In the KEY-LISTVAL trigger, modify the code like this
  LIST_VALUES;
  clear_form(no_validate);
  EXECUTE_QUERY;
  

4. Now in PRE-QUERY Trigger of DEPARTMENT ,write this code.

  if :parameter.DEPTID is not null then
	:DEPARTMENT.DEPARTMENT_ID:=:parameter.DEPTID;
        :parameter.DEPTID:=null;
  end if;
  


Now run the form.
I think you understood the coding. If need clarifications, Please reply.

Regards
Sasi..
Re: Do You Want to Save... [message #302416 is a reply to message #149163] Mon, 25 February 2008 09:59 Go to previous messageGo to next message
marvSQL
Messages: 13
Registered: February 2008
Location: JAMAICA
Junior Member
thanks djmartin and sasipalarivattom for your qick responces.

to answer djmartin's question: no i did not want to make any change to the record. i only wanted the values selected from the l.o.v to be displayed in the DEPARTMENT_ID and the DEPARTMENT_NAME fields of my form but according to sasipalarivattom the block status will be modified as 'CHANGED'.
i now understand. thanks guys!!


Re: Do You Want to Save... [message #302878 is a reply to message #302416] Wed, 27 February 2008 04:17 Go to previous messageGo to next message
sasipalarivattom
Messages: 118
Registered: June 2007
Location: Cochin ( INDIA )
Senior Member

Dear Marvy,
Is it working properly now?

Regards
sasi...
Re: Do You Want to Save... [message #303513 is a reply to message #302878] Fri, 29 February 2008 11:40 Go to previous messageGo to next message
marvSQL
Messages: 13
Registered: February 2008
Location: JAMAICA
Junior Member
sasipalarivattom , i made the modifications that you told me to do.when i press the button the l.o.v did not launch.the employee datablock was filled with all the emploees.
-----------------------------------------------

I then commented the code in the key-listval trigger of DEPARTMENT.DEPARTMENT_ID :

LIST_VALUES;
--clear_form(no_validate);
EXECUTE_QUERY;

I then compiled and ran program again.it gave the following results:
* the first time the button is pressed after i run the program, the l.o.v does not show up.but the first record in the department table show up in the DEPARTMENT datablock and the employees related to that department shows up in the EMPLOYEE datablock
*if the button is pressed again(for the second time and all other attemps after that) the l.o.v shows up and everthing seems to work perfectly

i just dont know why the l.o.v doesnt show up when the button is pressed the first time
Re: Do You Want to Save... [message #304113 is a reply to message #303513] Tue, 04 March 2008 02:07 Go to previous messageGo to next message
sasipalarivattom
Messages: 118
Registered: June 2007
Location: Cochin ( INDIA )
Senior Member

Can you attach the latest fmb?
Re: Do You Want to Save... [message #305341 is a reply to message #304113] Mon, 10 March 2008 08:32 Go to previous messageGo to next message
marvSQL
Messages: 13
Registered: February 2008
Location: JAMAICA
Junior Member
here is the new fmb file
Re: Do You Want to Save... [message #307607 is a reply to message #305341] Wed, 19 March 2008 04:44 Go to previous messageGo to next message
sasipalarivattom
Messages: 118
Registered: June 2007
Location: Cochin ( INDIA )
Senior Member

Dear Marvy,

Sorry for the late reply.
can you try the form now?

I made some changes.

1. In the lov button
( Changed the command "execute_trigger" to "do_key" )
2. In KEY-LISTVAL trigger of 'DEPARTMENT_ID' fileld
3. In the Datablock position( Department block moved up ).

Regards
sasi...
Re: Do You Want to Save... [message #308831 is a reply to message #307607] Tue, 25 March 2008 10:58 Go to previous messageGo to next message
marvSQL
Messages: 13
Registered: February 2008
Location: JAMAICA
Junior Member
thanks a lot sasi!! it worked perfectly !!
what i would like to know is why was it behaving this way before you made the changes.
Re: Do You Want to Save... [message #310666 is a reply to message #308831] Wed, 02 April 2008 00:22 Go to previous message
sasipalarivattom
Messages: 118
Registered: June 2007
Location: Cochin ( INDIA )
Senior Member

Dear Marvy,

What would I like to say is
Check it yourself. Once if you can understand what is wrong in your
form, you will never forgot it.
One more thing, Do post your thoughts for the use of other members.

One suggestion.
What I heard from my seniors is that use "execute_trigger" command
only when there isn't any other way..

Thanks and Regards
Sasi..
Previous Topic: FRM-40735: ON-INSERT Trigger raised unhandled exception ORA-00984
Next Topic: update
Goto Forum:
  


Current Time: Wed Dec 07 16:20:47 CST 2016

Total time taken to generate the page: 3.55917 seconds