databaseManager.recalculate(foundset)?

I’m not getting anywhere with this command.

I’m trying to run against my foundset in Oracle and nothing seems to happen.

Is this all I need or does this need to done in a loop? If I edit the related fields, my calculated values recalc. Nothing else seems to be working. Not sure what I’m doing wrong.

Thanks,
Lee Snover

Works great for me. What you need is a foundset. So if you want to calculate all records in a form ‘test’, its should work like this:

forms.test.controller.loadAllRecords();
databaseManager.recalculate(foundset);

patrick:
Works great for me. What you need is a foundset. So if you want to calculate all records in a form ‘test’, its should work like this:

forms.test.controller.loadAllRecords();

databaseManager.recalculate(foundset);

Patrick:

I’m trying it again. It’s a pretty big record set.

Is there a way to have a “working” dialog, or some other indicator display while Servoy is performing an extended task?

I have no clue where it is in the process, and if it’s going to take awhile, it would be nice to have some indication.

Regards,
Lee Snover

There is no progress sign… I have built my own little logic. The trick with that is that I have a stored calc called “sys_calc” with a formula “return 1;”. So if Servoy calculates a record, this column gets a one. With that, you can do something like this:

var formName = arguments[0]; // the name of the form
var pk = arguments[1]; // the name of the primary key of the table
var table = forms[formName].controller.getTableName();
var fetchSize = 200;
var i = 0;

application.output ('start calculation of table ' + table + ' at ' + new Date() )

var query = '';
if (fetchSize)
{
	query = 'SELECT TOP ' + fetchSize + ' ' 
}
else
{
	query = 'SELECT ' 
}
query += table + '.' + pk + ' FROM ' + table + ' '
query += 'WHERE sys_calc IS NULL ORDER BY ' + table + '.' + pk

do
{
	i += fetchSize;
	forms[formName].foundset.clearFoundSet();
	forms[formName].controller.loadRecords(query);
	application.setStatusText('Calculating ' + forms[formName].controller.getTableName() + ': ' + i + ' calculated')
	application.output ('    ' + i + ' records calculated at ' + new Date())
	databaseManager.recalculate(forms[formName].foundset);
}
while ( forms[formName].foundset.getSize() > 0 )

application.output ('end calculation of table ' + table + ' at ' + new Date() )

Hope this helps.

patrick:
There is no progress sign… I have built my own little logic. The trick with that is that I have a stored calc called “sys_calc” with a formula “return 1;”. So if Servoy calculates a record, this column gets a one. With that, you can do something like this:

var formName = arguments[0]; // the name of the form

var pk = arguments[1]; // the name of the primary key of the table
var table = forms[formName].controller.getTableName();
var fetchSize = 200;
var i = 0;

application.output ('start calculation of table ’ + table + ’ at ’ + new Date() )

var query = ‘’;
if (fetchSize)
{
query = 'SELECT TOP ’ + fetchSize + ’ ’
}
else
{
query = 'SELECT ’
}
query += table + ‘.’ + pk + ’ FROM ’ + table + ’ ’
query += 'WHERE sys_calc IS NULL ORDER BY ’ + table + ‘.’ + pk

do
{
i += fetchSize;
forms[formName].foundset.clearFoundSet();
forms[formName].controller.loadRecords(query);
application.setStatusText(‘Calculating ’ + forms[formName].controller.getTableName() + ‘: ’ + i + ’ calculated’)
application.output (’ ’ + i + ’ records calculated at ’ + new Date())
databaseManager.recalculate(forms[formName].foundset);
}
while ( forms[formName].foundset.getSize() > 0 )

application.output ('end calculation of table ’ + table + ’ at ’ + new Date() )




Hope this helps.

Patrick:

You are more than considerate with all your help. This is quite a chunk of code for a non-Java person. Will take me a bit to obsorb.

With all that Servoy says about doing things better then Filemaker, I would think this would be a standard feature. I’m still not gettting anywhwere with my Recalc. I can see Servoy doing a full table scan in Oracle, then nothing. Servoy is unresponsive, but I’m guessing it’s doing something.

Regards,
Lee