Mike
|
Posted: 04/30/2004, 9:11 AM |
|
I have 2 forms. One is an editable grid child of records.
When I try to insert a child record I get the following error: PostgreSQL Error: 1 (ERROR: null value in column "people_id" violates not-null constraint ). I need to add the parent record id to the insert statement.How do I do that?
|
|
|
peterr
Posts: 5971
|
Posted: 04/30/2004, 11:59 AM |
|
This looks similar to our Master-Detail examples in CCS Example Pack.
For example at http://examples.codecharge.com/ExamplePack/OrderEntry/O....php?order_id=3 when you add a new Item then it is added as a child record for the currently selected order. This was implemented by adding hidden field to the Editable Grid that contains the order_id.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com |
|
|
mike
|
Posted: 04/30/2004, 12:43 PM |
|
When adding a record to a grid the fields are empty
How do get the value in the hidden field into the insert statement
Thanks
|
|
|
peterr
Posts: 5971
|
Posted: 04/30/2004, 1:23 PM |
|
Take a look at that example, especially the "Data Source" property of that grid.
The Web users must specify somehow which parent record they are working with and this is usually done by the users selecting some record in the parent grid first, and then the URL would contain that parent record just like the URL http://examples.codecharge.com/ExamplePack/OrderEntry/O....php?order_id=3 contains "order_id=3".
You can then use this parent record's id in a variety of ways, either to populate the hidden field, or to utilize WHERE statement that says "WHERE order_id = (parameter value)" as shown in our example.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com |
|
|
peterr
Posts: 5971
|
Posted: 04/30/2004, 1:53 PM |
|
I just took a look at that sample project and I see that the value of the hidden field (order_id) is set in the "Before Build Insert" event using this code (ASP):
If not isEmpty(request.QueryString("order_id")) Then
store_orders_items.DataSource.order_id.Value = request.QueryString("order_id")
End If
This means that order_id is set to the value of the URL parameter with the same name (order_id).
You didn't specify which programming language you use but you can find equivalent code in any programming language if you look at that example project.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com |
|
|