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.
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() )
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.