On Feb 15, 2012, at 10:09 PM, Vineet Deodhar wrote: > I am using save() method. > The matter is that, before calling save(), I must call new() + > setFieldVal() on appended record(s) ; > For updated records, seek() + setFieldVal().
I still don't understand why this is a problem for you. Are you simply trying to write your application using the fewest lines of code possible? To me, it looks like you are doing the bare minimum necessary: determining the record, whether it exists or newly created, and then making your changes. Keep in mind that doing something as simple as calling bizobj.new() does a lot more than simply append a blank record to the local cursor. There are hook methods that fire before and after the record is appended, allowing you to do things like check security settings to make sure that the user is authorized to perform that action, or populate the PK of the new record, or set default values for any number of columns in the new record automatically. You may not need any of these for your current usage, but remember that this is an application framework, and as such it needs to be able to handle a wide range of use cases. > If I were using UI layer, I think this can be taken care of by dabo > automatically (pl. correct me if I am wrong). > Since I am using just biz & db layers, I need to identify the appended > records & updated records myself. > Then call save() on parent bizobj. You'd probably want to call saveAll(), rather than call save() once for each record. Keep in mind that save() doesn't just blindly write your data, either. It includes data validation hooks, pre- and post-processing of the data, error handling, etc. This is why each part of the process is separated out: different developers will need to customize different parts for the particular application that they are developing. If you really absolutely have to do all this in a single line, you can: New record: bizobj.safeExecute("insert into mytable values ('foo', 'bar', 99)") Updated record: bizobj.safeExecute("update mytable set col1='foo', col2='bar' where id=42") Of course, you are completely bypassing the framework hooks and interacting with the database directly, so no validation or error-handling is available. -- Ed Leafe _______________________________________________ Post Messages to: Dabo-users@leafe.com Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users Searchable Archives: http://leafe.com/archives/search/dabo-users This message: http://leafe.com/archives/byMID/60bf5078-ae9a-4656-a381-2ff2e9758...@leafe.com