« [TIP] Get record data by PK ID without executing a search | Main | [Tip] Using graphics in table column headers »

January 29, 2008

[Challenge] Difference between controller.newRecord() and foundset.newRecord()

by David Workman
Data Mosaic

Here's a trivia question for you: what are the differences between the controller.newRecord() function and foundset.newRecord() function?

Both functions create a new record. But after that there are some interesting and subtle differences. I'll give you a day or two to think this one through. Feel free to post your thoughts!

| Posted by David Workman on January 29, 2008 at 03:37 PM in Challenge | Permalink

Comments

I'dd say that the main difference would be that controller.newRecord() uses a form controller to create a record.
Which means that you could trigger an onLoad, onShow or onRecordSelection method by doing this.
That's one one the reasons I prefer to use foundset.newRecord().

Posted by: Karel Broer | Feb 1, 2008 6:18:10 AM

Hello David

I like your (trivia) question very much, although I don't think it's trivia. Has someone a really good overview of what the foundset is with all of its characteristics and differences to db content and what's displayed on the human interface?
Thanks for the question, I have not a clear answer but I am waiting with interest for the solution :-)

Posted by: Robert Huber | Feb 5, 2008 4:01:41 AM

Hi David,

Both(controller.newRecord() and foundset.newRecord()), will create a new record in the current foundset. But the twist is attached with the 2nd. argument of foundset.newRecord( [addOnTop], [changeSelection]). If the value to changeSelection is false, then it will create a new record but the new record won't be get selected, no onRecordSelection Event etc. get fired(as Karel specified).

Posted by: Arup Ranjan Sahoo | Feb 7, 2008 12:18:25 AM

Hi David,

I am beginer for servoy. Whatever i learn and see according to that, the only difference between then.
controller.newRecord([addOnTop]) taking one argument that is creating record in top or bottom, and about foundset.newRecord( [addOnTop], [changeSelection]) first argument create record on top or bottom, the other argument is used for deciding the selection of record.

Posted by: Prem Chand Mali | Feb 12, 2008 5:21:08 AM

Don't let us wait any longer.
A day or two are passed now.
Tell us exactly what the difference is.

Posted by: Martin | Mar 10, 2008 4:46:44 AM

Post a comment