Home » Developer & Programmer » Forms » About ignore record when commit
About ignore record when commit [message #679581] Tue, 10 March 2020 07:39 Go to next message
compuscience
Messages: 63
Registered: September 2012
Member
I need to ask about
I have Oracle forns 6i
And i create cursor to return data when i open the form
I put degree for each record then save it each record
I need to save only record which i out degree in it

And ignore which i didn't put in it


How can i do that
Re: About ignore record when commit [message #679591 is a reply to message #679581] Tue, 10 March 2020 10:05 Go to previous messageGo to next message
cookiemonster
Messages: 13894
Registered: September 2008
Location: Rainy Manchester
Senior Member
Forms will save any records that are marked as changed.
They get marked as changed when you modify a datablock item, even if you set the item to the value it was already.
So don't modify items where nothing has changed.

If you want an explanation of how to do that in your case you will need to post the code you're running.
Re: About ignore record when commit [message #679606 is a reply to message #679591] Tue, 10 March 2020 14:00 Go to previous messageGo to next message
compuscience
Messages: 63
Registered: September 2012
Member
okay
now i need to change record status from changed to new
how can i do that
Re: About ignore record when commit [message #679612 is a reply to message #679606] Tue, 10 March 2020 16:19 Go to previous messageGo to next message
Littlefoot
Messages: 21559
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
With SET_RECORD_PROPERTY, using the NEW_STATUS.
Re: About ignore record when commit [message #679620 is a reply to message #679612] Wed, 11 March 2020 03:43 Go to previous messageGo to next message
compuscience
Messages: 63
Registered: September 2012
Member
This code in which trigger
Re: About ignore record when commit [message #679622 is a reply to message #679620] Wed, 11 March 2020 03:47 Go to previous messageGo to next message
cookiemonster
Messages: 13894
Registered: September 2008
Location: Rainy Manchester
Senior Member
The trigger that caused the status to go to changed would be the obvious choice.

However it would be far better to avoid changing the status to changed in the first place.
Re: About ignore record when commit [message #679623 is a reply to message #679622] Wed, 11 March 2020 03:55 Go to previous messageGo to next message
compuscience
Messages: 63
Registered: September 2012
Member
I retrieve rows from database in forms 6i
I change one value only in all records

What happen when i change value in one record and commit then all records commited

What i need to save only what i change not all

[Updated on: Wed, 11 March 2020 03:56]

Report message to a moderator

Re: About ignore record when commit [message #679624 is a reply to message #679623] Wed, 11 March 2020 04:38 Go to previous messageGo to next message
cookiemonster
Messages: 13894
Registered: September 2008
Location: Rainy Manchester
Senior Member
I understood that the first time.
At this point it would help if you actually posted the code.
Re: About ignore record when commit [message #679625 is a reply to message #679624] Wed, 11 March 2020 05:42 Go to previous messageGo to next message
compuscience
Messages: 63
Registered: September 2012
Member
I will get it
Re: About ignore record when commit [message #679638 is a reply to message #679625] Wed, 11 March 2020 16:32 Go to previous messageGo to next message
compuscience
Messages: 63
Registered: September 2012
Member
this is my code which retrieve data in when_new_form_instance

declare
cursor xxx is select employee_no,employee_name from employeeloyee;

begin
for i in xxx loop
:employee_no:=i.employee_no;
:employee_name:=i.employee_name;

next_record;
end loop;

first_record;
end;



and i have 3 column in forms
employee_no,employee_name,value


i have trigger in value column key_next_item
if :employee_no is not null value is not null then
commit;
next_record;
end if;


this is my code in this form



what i need
when i enter this form i retrive employee_no,employee_name an i put his value
i need to save what i enter only
Re: About ignore record when commit [message #679640 is a reply to message #679638] Thu, 12 March 2020 01:09 Go to previous messageGo to next message
Michel Cadot
Messages: 67132
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Michel Cadot wrote on Sun, 05 January 2020 15:06

Please read the OraFAQ Forum Guide and How to use [code] tags and make your code easier to read.
Also always post your Oracle version, with 4 decimals, as solution depends on it.

And feedback to people who help you.

Re: About ignore record when commit [message #679642 is a reply to message #679640] Thu, 12 March 2020 04:25 Go to previous messageGo to next message
cookiemonster
Messages: 13894
Registered: September 2008
Location: Rainy Manchester
Senior Member
Why on earth are you not using execute_query to populate the form?

Do that and your problem goes away.
Re: About ignore record when commit [message #679643 is a reply to message #679642] Thu, 12 March 2020 05:00 Go to previous messageGo to next message
compuscience
Messages: 63
Registered: September 2012
Member
this is my code which retrieve data in when_new_form_instance

declare
cursor xxx is select employee_no,employee_name from employeeloyee;

begin
for i in xxx loop
:employee_no:=i.employee_no;
:employee_name:=i.employee_name;

next_record;
end loop;

first_record;
end;

and i have 3 column in forms
employee_no,employee_name,value


i have trigger in value column key_next_item
if :employee_no is not null value is not null then
commit;
next_record;
end if;
this is my code in this form



what i need
when i enter this form i retrive employee_no,employee_name an i put his value
i need to save what i enter only
Re: About ignore record when commit [message #679644 is a reply to message #679642] Thu, 12 March 2020 05:00 Go to previous messageGo to next message
compuscience
Messages: 63
Registered: September 2012
Member
cookiemonster wrote on Thu, 12 March 2020 11:25
Why on earth are you not using execute_query to populate the form?

Do that and your problem goes away.
thank you very much
i will try it and give feed back to you

[Updated on: Thu, 12 March 2020 05:10]

Report message to a moderator

Re: About ignore record when commit [message #679645 is a reply to message #679642] Thu, 12 March 2020 05:18 Go to previous messageGo to next message
compuscience
Messages: 63
Registered: September 2012
Member
may you help me how can i use my code in execute_query
Re: About ignore record when commit [message #679646 is a reply to message #679642] Thu, 12 March 2020 05:18 Go to previous messageGo to next message
compuscience
Messages: 63
Registered: September 2012
Member
cookiemonster wrote on Thu, 12 March 2020 11:25
Why on earth are you not using execute_query to populate the form?

Do that and your problem goes away.

may you help me how can i use my code in execute_query
Re: About ignore record when commit [message #679647 is a reply to message #679646] Thu, 12 March 2020 05:23 Go to previous messageGo to next message
cookiemonster
Messages: 13894
Registered: September 2008
Location: Rainy Manchester
Senior Member
Execute_query would replace the code you've got in when-new-form-instance.
I suggest you read the form builder help topic on it.
Re: About ignore record when commit [message #679648 is a reply to message #679647] Thu, 12 March 2020 05:55 Go to previous messageGo to next message
compuscience
Messages: 63
Registered: September 2012
Member
cookiemonster wrote on Thu, 12 March 2020 12:23
Execute_query would replace the code you've got in when-new-form-instance.
I suggest you read the form builder help topic on it.

aha

but this data came from another table
Re: About ignore record when commit [message #679651 is a reply to message #679648] Thu, 12 March 2020 06:36 Go to previous messageGo to next message
cookiemonster
Messages: 13894
Registered: September 2008
Location: Rainy Manchester
Senior Member
Do you think that maybe you should have pointed that out at the start?

So you're opening a form.
The form has a datablock based on one table
You are populating this block with data from another table
You are then letting users enter a value for the value field.
You want to save all records where users have entered a value to the table the block is based on.

Does that describe the functionality you want?

If so, that's how you should have presented the issue in the first place.

This really just begs the question - why are two tables involved here? Why not just one?
Re: About ignore record when commit [message #679653 is a reply to message #679651] Thu, 12 March 2020 07:17 Go to previous messageGo to next message
compuscience
Messages: 63
Registered: September 2012
Member
cookiemonster wrote on Thu, 12 March 2020 13:36
Do you think that maybe you should have pointed that out at the start?

So you're opening a form.
The form has a datablock based on one table
You are populating this block with data from another table
You are then letting users enter a value for the value field.
You want to save all records where users have entered a value to the table the block is based on.

Does that describe the functionality you want?

If so, that's how you should have presented the issue in the first place.

This really just begs the question - why are two tables involved here? Why not just one?

you are right sir
but i have two table
employees (no,name) and degree(no,value for each employee)
that's why i have two table
Re: About ignore record when commit [message #679654 is a reply to message #679653] Thu, 12 March 2020 07:34 Go to previous messageGo to next message
cookiemonster
Messages: 13894
Registered: September 2008
Location: Rainy Manchester
Senior Member
That's not an explanation of why you have two tables.
It's just a statement that you have two tables.

What is the relationship between the 2 tables?
If it's 1 to 1, as it would appear to be, then you should combine them into one table and everything becomes simple.
Re: About ignore record when commit [message #679655 is a reply to message #679654] Thu, 12 March 2020 07:48 Go to previous messageGo to next message
compuscience
Messages: 63
Registered: September 2012
Member
now how can i save changes only after retrieve
Re: About ignore record when commit [message #679659 is a reply to message #679655] Thu, 12 March 2020 08:30 Go to previous message
cookiemonster
Messages: 13894
Registered: September 2008
Location: Rainy Manchester
Senior Member
Populating a modifiable block the way you're doing is a major pain.

You can try basing the block on a view - outer-join the two tables
then have an instead of update trigger on view that will insert/update the table the block is based on at the moment.
If that doesn't work base the block on a procedure.

But the best solution in the long run is likely to be combining the two tables into one, unless there's a particularly good reason why you need two.
Previous Topic: Form show message box before Run
Next Topic: Only numbers are allowed
Goto Forum:
  


Current Time: Tue May 26 08:55:30 CDT 2020