This topic is locked

Inserting a new record into details table

4/1/2017 12:49:05 AM
PHPRunner General questions
P
peterp author

Hi All,

I'm sure somebody must have done this but what I'm trying to do is firstly enter header information such as customer name, address, and date then before any saving is done I do an inline add to the details which consists of item number, qty,and price and then this calculates the total that is placed in the header then I push the save button. All goes well except he details lines are not created as the orderid is not allowed to be null. I have tried various ways with events that during the add of the master record then the orderid is written to the details table but this fails with an error saying that the master record was saved but the detail was not as the orderid cannot be null. So how do I get the orderid field in the details table to be the same as the order header field when the order header and detail lines are saved.
Any help will be appreciated

Best Regards,

Peterp

romaldus 4/1/2017



Hi All,

I'm sure somebody must have done this but what I'm trying to do is firstly enter header information such as customer name, address, and date then before any saving is done I do an inline add to the details which consists of item number, qty,and price and then this calculates the total that is placed in the header then I push the save button. All goes well except he details lines are not created as the orderid is not allowed to be null. I have tried various ways with events that during the add of the master record then the orderid is written to the details table but this fails with an error saying that the master record was saved but the detail was not as the orderid cannot be null. So how do I get the orderid field in the details table to be the same as the order header field when the order header and detail lines are saved.
Any help will be appreciated

Best Regards,

Peterp


just to make sure, check the details table.

there should be two mandatory fields:
ORDERID > this field is linked from master table

ORDER_DETAIL_ID > This one is auto increment field (primary key) in details table