Home » Developer & Programmer » Forms » Cannot save data
Cannot save data [message #194132] Wed, 20 September 2006 22:37 Go to next message
wency
Messages: 450
Registered: April 2006
Location: Philippines
Senior Member

I have a block named aaa, query data source name is bbb and
DML data target name is bbb. When I insert record it does not saved on bbb table. Not saved as well on aaa table.

This is a database block, I wonder why I can't saved on table bbb. Any idea on this?
Re: Cannot save data [message #194147 is a reply to message #194132] Thu, 21 September 2006 00:18 Go to previous messageGo to next message
sandeepk7
Messages: 137
Registered: September 2006
Senior Member

is there any error message appearing? what the code you have written for save?


Sandy
Re: Cannot save data [message #194197 is a reply to message #194147] Thu, 21 September 2006 02:51 Go to previous messageGo to next message
djmartin
Messages: 10180
Registered: March 2005
Location: Canberra ACT Australia
Senior Member
Account Moderator
From where did table 'aaa' come? I thought it was the name of the block?

I believe you are manually inserting your records. Forms will do it for you, you don't have to write your own code. Anyway, I also believe that you are using a 'commit' or 'form_commit' statement after you do your own code. But as the Form does not 'sense' your manual inserts and updates you need to use 'standard.commit' to save your manually made changes.

David
Re: Cannot save data [message #194207 is a reply to message #194132] Thu, 21 September 2006 03:29 Go to previous messageGo to next message
wency
Messages: 450
Registered: April 2006
Location: Philippines
Senior Member

I got it.
The problem now is on the master-detail relation. The relation is based on (a=a, b=b, c=c), but when I change the column d on master, I fetch nothing for details. As I understand it, the data will be retrieve as far as the condition was met.
Re: Cannot save data [message #194382 is a reply to message #194207] Thu, 21 September 2006 18:49 Go to previous messageGo to next message
djmartin
Messages: 10180
Registered: March 2005
Location: Canberra ACT Australia
Senior Member
Account Moderator
If 'd' is part of the primary key in the 'master' table, then 'd' must exist in the 'detail' table.

A master-detail form needs very little in terms of developer written code, initially. Define the 'master' table with a primary key (eg 'invoice number'). Define the 'detail 'table with the 'master' primary key plus the 'detail' key (like 'line number').

I do NOT like, or use, the EXTERNAL invoice number or EXTERNAL line number as my primary keys. I think it is better to use an Oracle sequence for the internal invoice number and a database generated value for the external value so that there is better control over the externalally displayed value, and so that the user is able to change the order of the lines as they are presented on the invoice WITHOUT changing the primary keys on the tables.

Use the wizard to create the 'master' block, use 'default value' to populate the primary key or use the When-Create-Record trigger. Create the 'detail' block using the wizard and again either use 'default value' to populate the primary key or use the When-Create-Record trigger on this block. Build a 'relations' between the two blocks. That's basically all you have to do.

David
Re: Cannot save data [message #194383 is a reply to message #194132] Thu, 21 September 2006 19:58 Go to previous messageGo to next message
wency
Messages: 450
Registered: April 2006
Location: Philippines
Senior Member

Hi David,

Both tables have no primary key.
I followed your instruction, I've created blocks from the scratch, but I don't encounter any regarding what you have said "default value" to populate primary key. I'm using oracle 5.0.

If i'm going to When-Create-Record trigger, what code I'm going to write? I'm having hard time searching F1.

Thanks!

Wency

[Updated on: Thu, 21 September 2006 20:00]

Report message to a moderator

Re: Cannot save data [message #194413 is a reply to message #194383] Fri, 22 September 2006 01:23 Go to previous messageGo to next message
djmartin
Messages: 10180
Registered: March 2005
Location: Canberra ACT Australia
Senior Member
Account Moderator
The When-Create-Record in the 'Master' populates the key fields. The WCR in the 'detail' get the values from the 'master' and puts them into the non-displayed key fields.

David
Re: Cannot save data [message #194422 is a reply to message #194132] Fri, 22 September 2006 02:10 Go to previous message
wency
Messages: 450
Registered: April 2006
Location: Philippines
Senior Member

Hi David,

I solved it.
Thanks for the inputs!

Wency
Previous Topic: Scroll bar and radio buttons
Next Topic: web application using form 6i
Goto Forum:
  


Current Time: Thu Dec 08 16:20:41 CST 2016

Total time taken to generate the page: 0.04882 seconds