I was testing the data broadcast mechanism on the Web Client and I found the following situation not to work:
Session 1 is in find mode and session 2 adds a record to the same table (whether in find mode or not). In that case session 1 is not updated and doesn’t see this new record appear. But, if session 2 modifies or deletes a record then session 1 is updated properly. A new record appears when session in is not in find mode though.
The same thing happes when you’ve narrowed your foundset by using a query. Changes are being updated, but new records are not.
I guess in that case I would have to work with the onDataBroadcast option in case I want to refresh and display new records automatically. I tried that a bit and there are a few available parameters. For example, the parameter dataSource is returned as a string:
db://
Is there any specific way to extract the database server and table? Or should I just write something myself?
And last but not least, is the onDataBroadcast method executed for each individual change? Or are changes accumulated and sent (in an array or something) at once?
I am not sure if we are talking about the same thing here. What I mean is that if a new record has been added to a table, the onDataBroadcast method is triggered for the other session (although the automatic broadcast mechanism doesn’t result in showing it). If I determine for which table this happened (by using the receiving parameters), I can execute a refresh of the foundset which has been retrieved by a query.
there are 2 methods to get the server/table name from a data source:
databaseManager.getDataSourceServerName(dataSource)
databaseManager.getDataSourceTableName(dataSource)
Note that most (if not all) servoy methods work with data source string, so you probably don’t need to convert.