Refresh single table in all clients

Hi,

I have an stored procedure that updates a single table in the DB. The process may update any number of records each time it runs and it is run from within a Servoy program.

Is there a way for the client that has just run this program to signal all attached clients that their cached records for that table (and only that table) are now invalid and should be refreshed? I can see that the entire data cache can be flushed from the Servoy admin page but I want to do it for a single table and from within a Servoy program.

Thanks
Steve

Maybe this will work: if you have a way of recognising the updated records, you can load them into a foundSet and refresh this foundSet from the database using the databaseManager…

Hi Steve,

to signal all clients to refresh the data of a certain table, you can use:

plugins.rawSQL.flushAllClientsCache(_sServerName, _sTableName)

Depending on the usage of the table, it can be a heavy operation.

Another way to make sure users see the latest data is by using:

databaseManager.refreshRecordFromDatabase(_fs, -1)

Downside of this function is that it will only refresh the records for the client on which is it is executed.
I’ve used this in the past for refreshing data coming from a database view.
So each time the user entered a form using this view, data would be refreshed.
Because the datasource (db view) was immutable anyway, this method worked fine for the situation.

Hope this helps

@Christian - that would work but the table has 2 million records and I have no way of knowing which records are updated so even just loading the foundset would be an expensive operation

mboegem:

plugins.rawSQL.flushAllClientsCache(_sServerName, _sTableName)

That is perfect as each client would only have a few records loaded from that table at a time so it would be trivial for their client to reload them - thanks Mark

I have a similar situation, but I have a field in the table called needs refresh and the outside process flags the report that servoy needs to load.