Reloading current record

How can I force a data reload of just the current record (for the form currently being browseed) ?

I am looking for a simple function that can be invoked from a method.
I do not want to lose the current found set and I do not want to relaod the current found set.

I simply want to reload the current record.

mtia
Julian

See databaseManager.refreshRecordFromDatabase

//Refresh record from database incase other programs did change the database record
//refresh the second record from current foundset (-1 can be used to refresh all records but is more expensive operation)
databaseManager.refreshRecordFromDatabase(foundset,2)

thanks patrick

Unfortunately, the database-manager object is not accessible from plugins :(

From my plugin java code I would like to reload the current record.
The only way I can [almost] see to do this is along the following lines:

final IClientPluginAccess clientAccess = _clientPlugin.getClientAccess();
final IFormManager formManager = clientAccess.getFormManager();
final IForm currentForm = formManager.getCurrentForm();
//now, neither of these 2 functions is what I want and neither gives me the outcome I require, but they illustrate that it may be somwhow possible
currentForm.loadAllRecords();
currentForm.reLookupValues();
//what I do want is something like:
currentForm.refreshRecordFromDatabase()
//in fashion similar to the previous post

Whats wrong with:

Pseudo code

var record = recordid
controller.find()
recordid = record
controller.search()

I think you’re giving me javascript code.
I need java code.
Servoy plugin java software has no javascript context afaik.

I would post this as a feature request. Makes sense…

btw relookup performs what it says a relookup of predefined values…

Perhaps this can help:

import com.servoy.j2db.dataprocessing.JSDatabaseManager;
import com.servoy.j2db.plugins.ClientPluginAccessProvider;
import com.servoy.j2db.IApplication;

IApplication iapp = ((ClientPluginAccessProvider)clientpluginaccess).getApplication();

JSDatabaseManager dbm = new JSDatabaseManager(iapp);
IFoundSet fs = app.getFormManager().getCurrentForm().getFoundSet();
dbm.refreshRecordFromDatabase(fs,2)

excellent post danny :)

thanks
J

Form update fails with:
dbm.js_refreshRecordFromDatabase(fs,index);

Whether I invoke this on the event dispatch thread or a concurrent thread, the form UI is not updated. The user needs to invoke a found-set refresh (say, via a mode swap to designer and back to browse) - ugly.

I perform checks to ensure that the index and found-set before invoking the call, so the set and index values are good (ie. the user has not navigated away from the record or worse still into another found set).

I get this behaviour in 1.4.2 and 1.5.0_04.

Any thoughts ?

If you are doing changes in the database directly via a server plugin, you could use IServerAccess.flushAllClientsCache to make clients reload records from a table.

danny:
JSDatabaseManager dbm = new JSDatabaseManager(iapp);

I strongly suggest never to use non published classes :!: it might influence the stability of Servoy or not work at all in new versions…