Force clients to refresh

I have an solution which works with a mysql db.
Now some records of this db are created or updated by external php scripts.
Of course the servoy clients “do not see” these updates unless they reload/update their foundset.
Question:
Is there a way I can force the servoy clients to update by deeplinking some method in the servoy solution or any other way from the php script? note, if any easier, that the servoy server, php server and mysql server are the same, so a local action can also be done.

You can use the rawsql plugin in Servoy for this. For example deeplink to a global method that will call flushAllClientsCache(…, …) or notifyDataChange(…, …, …, …) with parameters appropriate to what php affected.
It should do the job.

thanks, I’ll try the 2nd one, probably work fine. However this requires to load the smart client which takes many seconds, not really real time, I was hoping a more direct way, without any GUI to load…

You can trigger it by other means. For example you can use web-client or JSP/headless client.
Another idea is to use a table to tell a Servoy batch processor that PHP changed things. PHP writes something to that table and the batch processor checks that table from time to time and calls the rawsql methods.

I’m sure there are other ways to do it as well…

You can also use the rest_ws plugin to call a Servoy server web-service from PHP - a variation of using JSP/headless client on Servoy Server.

a batch won’t be in real time, but yes, the web client is the way, that will be quick enough. I’ll let you know how I did later on.

post got crossed, I’ll check this too. thanks.

I have tested the deeplink via the webclient, no result.
I changed the deeplink method to make the db change itself instead of php, thinking this would simulate a user entry, but it does not.
So I’m stuck, seems like you can only force the current client to reload the foundset, but not others.
However Servoy has a way to do it since a manual entry forces the others to update. Is it using a hidden event?
Is there a difference in between a change done by a method and a change done by a user regarding other clients update?

Using rawSql inside Servoy to make changes in the DB should be the same as doing them in PHP - no changes are seen until you call the notify/flush methods of the plugin.
When a user changes data, Servoy knows what data is changed and can do what those two methods do automatically.

So if you call notify/flush of the rawSql plugin correctly you should see changes reflected in all clients in a short time. But careful, those calls do not have an instant efect, they do not block until the changes are updated in all clients.
Can you detail a bit - what changes do you do to the DB and how do you call the notify/flush on the rawSql plugin?

Also check the values of following Servoy properties: servoy.disableDataChangeNotify, servoy.rawSQL.allowClientCacheFlushes.
They should either be not set or false - true.

I did not use the rawSQL plugin, I simply did a method to change the value I wanted to alter
so i’ll do the same with the rawSQL plugin then and let you know.

result:
ok for both ways now.

using a deeplinked method was ok except I had a syntax error (a form path missing as this method can only be global), it does simulates a user entry correctly IF the data is effectively altered; if the udpate does not affect any row (new value = former one), other clients don’t get notified. the error I did was to keep the php update and the deeplinked method update right after it; the latter one was then affecting nothing from a servoy pt of view.

using the plugins.rawSQL.notifyDataChange also works even if there is no servoy or rawsql update before, and can be limited to a single record (performancewise, this does matter normally) so this is my prefered way, a single line does it all, and the only arg to pass to the method is the record_id.

thanks very much Andrei, that is a good step for my hot folder activity monitoring.