Index
2000-09-20 12:25James Sayer : Error 1547 Cannot insert an empty row from view to base table.
2000-09-21 08:38Ed Leafe : Re: Error 1547 Cannot insert an empty row from view to base table.
Back to top
Error 1547 Cannot insert an empty row from view to base table.

Author: James Sayer

Posted: 2000-09-20 12:25:46   Link

Greetings All,

This post is informational regarding the error 1547, we spent some time researching this issue and found no good advice here on the forum or elsewhere. Perhaps these notes will help the next person.

This error condition was encountered when testing the data environment prior to completed programming. As a result some of the errors were introduced because the programming was not complete. But this isn't shocking when you consider that many people program in stages: get it working first, then add some value, then finish per client whims. <g>

First some background about the scheme, then reasoning for error:

We are using VFP views from VFP tables. We want to present a list of items to users that is customized for their site and where any item can be displayed for many sites. To do this we have a parent-child scheme:

parent.cid -->> | child.cid

parent.cItem | child.cidParent

parent.tEffective | child.cSite

The view has a parameter on the child.cSite value and that one field from the child table is included in the view. So the view that is used by the bizobj is all from the parent table with one field from the child table.

The view uses Optimistic Record Buffering. No indices on the view.

The child field is marked as not updatable.

All parent fields are updatable.

Now the testing part:

What we noticed in testing the data environment is that we could add a new record to the view without error, but if the record pointer is moved, error 1547 is generated.

The simple solution is to place a value into the one field from the child table. Then the pointer can move.

Reasoning:

Who know why VFP does anything that it does? "It works that way" may be the best reasoning available. To handle this issue what we have done is place code in the bizobj.OnNew() to populate that child field with the proper default value. Problem solved. The child table is open because it provides data for the view, but no data is updated in that table. Still it appears that the error is coming from the child base table.

I hope this helps the next person get an early start on their debugging.

James Sayer

©2000 James Sayer
Back to top
Re: Error 1547 Cannot insert an empty row from view to base table.

Author: Ed Leafe

Posted: 2000-09-21 08:38:23   Link

<i><font color="#663300">The view uses Optimistic Record Buffering. No indices on the view.

The child field is marked as not updatable.

All parent fields are updatable.

Now the testing part:

What we noticed in testing the data environment is that we could add a new record to the view without error, but if the record pointer is moved, error 1547 is generated.

The simple solution is to place a value into the one field from the child table. Then the pointer can move. </font></i>

I'm not sure I follow. Why is the pointer being moved? Why do you want to save a blank row to the table? Why don't you use table buffering?

Also, why isn't <b>IsNewAndEmpty()</b> being called during pointer movement? That should take care of the "cannot insert empty row" problem.

<font color="#cc0000"> ___/

/

__/

/

____/</font>

Ed Leafe

©2000 Ed Leafe