performUpdate() issue

Questions, tips and tricks and techniques for scripting in Servoy

performUpdate() issue

Postby jdcunha » Mon Apr 20, 2009 6:50 pm

Hi all,

Servoy 4.1.0
Java 1.6
Windows XP pro
Mysql 5.x database

I am having a weird issue with performUpdate function.

I have 700 records in my forms.timesheet.foundset

When I try to update a column using the performUpdate, It updates only 400 rows
Code: Select all
var theFoundsetUpdater = databaseManager.getFoundSetUpdater(forms.timesheet.foundset);
theFoundsetUpdater.setColumn('flag', 1);
theFoundsetUpdater.performUpdate();
databaseManager.saveData();


When I go to the timesheet layout I notice it alternately updates 200 rows (i.e updates first 200, followed by skipping the next 200, hence it updates 400 records and ignored 300 records)

But if I do the following it updates all the 700 rows
Code: Select all
for(var i=1;i <= databaseManager.getFoundSetCount(forms.timesheet.foundset); i++)
{
forms.timesheet.controller.setSelectedIndex(i);
forms.timesheet.flag = 1;
}
databaseManager.saveData();


Am I missing something in the performUpdate that results in skipping 200 rows at a time when doing the update.

Regards
jdcunha
jdcunha
 
Posts: 93
Joined: Wed Dec 19, 2007 7:59 pm

Re: performUpdate() issue

Postby rgansevles » Tue Apr 21, 2009 9:34 pm

jdcunha,


The foundsetupdater tries to do an update in 1 statement when possible, but falls back to single updates when that is not possible, it seems that something goes wrong there.
Do you have tracking turned on? Does the foundset have a related condition/filter?

Please create a case in our support system with a sample solution that shows this error.

See viewtopic.php?f=8&t=6062

Rob
Rob Gansevles
Servoy
User avatar
rgansevles
 
Posts: 1927
Joined: Wed Nov 15, 2006 6:17 pm
Location: Amersfoort, NL

Re: performUpdate() issue

Postby jdcunha » Tue Apr 21, 2009 9:47 pm

Hi Rob,

I do have tracking turned on for audit trail purposes.

What do you mean by foundset having a related condition/filter?

I will turn off tracking and run a test to see if it works.

Are there some special circumstances with respect to tracking that performUpdate does not work?

Regards
James
jdcunha
 
Posts: 93
Joined: Wed Dec 19, 2007 7:59 pm

Re: performUpdate() issue

Postby rgansevles » Tue Apr 21, 2009 10:41 pm

James,

When tracking is on we cannot do an 'update tab set col=val where condition' because we could not fill the tracking table.
With a related condition I mean, suppose you have searched in your foundset on a field from a relation, in that case we also fallback to update per record.

It should still update correctly, so if you have a situation where it does not, please file a case.

Rob
Rob Gansevles
Servoy
User avatar
rgansevles
 
Posts: 1927
Joined: Wed Nov 15, 2006 6:17 pm
Location: Amersfoort, NL

Re: performUpdate() issue

Postby jdcunha » Tue Apr 21, 2009 10:45 pm

Hi Rob,

I turned off tracking and it worked correctly.

Thanks for letting me know the details.

Regards
jdcunha
jdcunha
 
Posts: 93
Joined: Wed Dec 19, 2007 7:59 pm


Return to Methods

Who is online

Users browsing this forum: No registered users and 38 guests