Servoy 5.1 beta 3

Release notes for Servoy betas

Re: Servoy 5.1 beta 3

Postby lwjwillemsen » Fri Jan 29, 2010 12:23 pm

jcompagner wrote:the sample of update method does tell you that already:

//3) safely loop through foundset (starts with selected row)
controller.setSelectedIndex(1)
var count = 0
var fsUpdater = databaseManager.getFoundSetUpdater(foundset)
while(fsUpdater.next())
{
fsUpdater.setColumn('my_flag',count++)
}

will see if i can improve the doc itself a bit.


Johan,

From the Servoy Wiki :

//There are 3 types of possible use with the foundset updater
//1) update entire foundset
var fsUpdater = databaseManager.getFoundSetUpdater(foundset)
fsUpdater.setColumn('customer_type',1)
fsUpdater.setColumn('my_flag',0)
fsUpdater.performUpdate()

I am using (the very nice) option 1 in the hope that Servoy translates that into 1 SQL update statement...
You can see here is no need to set the selectedIndex !
Lambert Willemsen
Vision Development BV
lwjwillemsen
 
Posts: 680
Joined: Sat Mar 14, 2009 5:39 pm
Location: The Netherlands

Re: Servoy 5.1 beta 3

Postby jcompagner » Fri Jan 29, 2010 12:36 pm

that first one doesnt use the selected index.
Because that just generate 1 sql statement that updates the whole foundset at once.
Are you sure that you use it like that? What does the performance tab tell you when you clear it, then run it?
What kind of sql statements are fired?
Johan Compagner
Servoy
User avatar
jcompagner
 
Posts: 8863
Joined: Tue May 27, 2003 7:26 pm
Location: The Internet

Re: Servoy 5.1 beta 3

Postby lwjwillemsen » Fri Jan 29, 2010 3:06 pm

jcompagner wrote:that first one doesnt use the selected index.
Because that just generate 1 sql statement that updates the whole foundset at once.
Are you sure that you use it like that? What does the performance tab tell you when you clear it, then run it?
What kind of sql statements are fired?


Hi Johan,

My code :
var _fs = _fs0.duplicateFoundSet() // _fs0 is initial foundset
// _fs.setSelectedIndex(1)
var _fsu = databaseManager.getFoundSetUpdater(_fs)
_fsu.setColumn(_field, _value)
var _ok =_fsu.performUpdate()
if (_ok) {
databaseManager.saveData()
}

In performance tab appl.server :
00:00:016 4 00:00:002 Update update glb_supplier set log_modification_dt=?, glb_currency_id=? where glb_supplier_id = ? and owner_id in (?, ?)

So Servoy goes into foundset iterating mode in stead of 1 update statement for the whole foundset. In my test I have 6 records in the foundset and the selectedIndex is 2 (6-2=4 updatestatements)

I think the complete foundset updater does not work as described...
Lambert Willemsen
Vision Development BV
lwjwillemsen
 
Posts: 680
Joined: Sat Mar 14, 2009 5:39 pm
Location: The Netherlands

Re: Servoy 5.1 beta 3

Postby jcompagner » Fri Jan 29, 2010 5:22 pm

the value you put in is just a string or number right? (not an array with values)

also the foundset isnt build on a table that has tracking enabled?
Johan Compagner
Servoy
User avatar
jcompagner
 
Posts: 8863
Joined: Tue May 27, 2003 7:26 pm
Location: The Internet

Re: Servoy 5.1 beta 3

Postby lwjwillemsen » Fri Jan 29, 2010 5:55 pm

jcompagner wrote:the value you put in is just a string or number right? (not an array with values)

also the foundset isnt build on a table that has tracking enabled?


Johan,

1) Value is (just) an integer value.
2) Tracking is enabled on this foundset.
Lambert Willemsen
Vision Development BV
lwjwillemsen
 
Posts: 680
Joined: Sat Mar 14, 2009 5:39 pm
Location: The Netherlands

Re: Servoy 5.1 beta 3

Postby jcompagner » Fri Jan 29, 2010 6:01 pm

if you have tracking enabled for that table
we have to do it in a loop
else we cant support tracking if we just say "update x where y"
Johan Compagner
Servoy
User avatar
jcompagner
 
Posts: 8863
Joined: Tue May 27, 2003 7:26 pm
Location: The Internet

Re: Servoy 5.1 beta 3

Postby lwjwillemsen » Fri Jan 29, 2010 7:55 pm

jcompagner wrote:if you have tracking enabled for that table
we have to do it in a loop
else we cant support tracking if we just say "update x where y"


Hi Johan,

Ok, I see.

But the update process should (in the case of tracking enabled) process the whole foundset, starting at index 1 and not starting from the currently selected index !
Lambert Willemsen
Vision Development BV
lwjwillemsen
 
Posts: 680
Joined: Sat Mar 14, 2009 5:39 pm
Location: The Netherlands

Previous

Return to Latest Releases

Who is online

Users browsing this forum: No registered users and 1 guest