On Monday 19 March 2007 17:13, Paul McNett wrote: > Paul McNett wrote: > > Ed Leafe wrote: > >> On Mar 19, 2007, at 5:20 PM, Ed Leafe wrote: > >>> That sounds wrong. New, unchanged records in the cursor should be > >>> discarded. I wonder if any of the memento optimizations that were > >>> done recently overlooked this case. > >>> > >>> I'll look into it some more and get back to you. > >> > >> OK, I think I found the problem. The new code is assuming that a new > >> row is "changed"; it's not even bothering to check its memento: > >> > >> def isChanged(self, allRows=True): > >> if allRows: > >> return len(self._mementos) > 0 or len(self._newRecords) > >> > 0 > >> > >> The code also shows that the memento for the new row doesn't include > >> the default values, which is wrong. Guess I have to dig a lot deeper > >> to straighten this out. > > Ok, let me get this straight. You are saying that if I do a biz.new(), > but don't change any fields, the biz should never save that record to > the database? > In the context of my problem I believe that would be correct. I start out without any records in a child biz. I open the form and I added a childbiz.new(). This adds a record to my childbiz cursor. But does not add a record to the backend. If the user doesn't add anything to the childbiz then I should not create a backend record.
Recall what started this discussion. I have a table with one field arMemo (text) that is assocated with the parent on fk_arcust. On my form I have a dEditBox with DataSource = arcont and DataField = arMemo. If arcont contains a matching record all works. But if it does not contain a matching record the form opens and user can edit the dEditbox and the save does nothing - no error or logs. So Ed suggested that when the form is opened and the recordcount = 0 to childbiz.new(). But then I discovered that if I didn't enter anything in the dEditBox but did change something in the parent I got an error upon saving. see earlier message. I could of course use an "add" button. But in this case I'm talking about a adding single record. IOW I have a one to one relation. So using an "add" button seemed a little silly. If it were a grid and I was adding records then yes. > I'm not being argumentative, I'm really wondering if this is what is > desired because it goes against my own assumptions (if I ask for a new > record, I then expect that new record to want to get saved even if I > don't make changes to it, assuming the bizrules allow that, which by > default they would). -- John Fabiani _______________________________________________ Post Messages to: [email protected] Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev
