Hi, I need a Context/Application-scoped variable in Servoy. This variable should hold logged users’ information. Does Servoy have this type of variable?
I also need a static function for this, to enable locking of a specific function. Should I be needing a server-side plugin for this?
Erik,
ad 1. I need a Context/Application-scoped variable
All code and variables are running within a client, if you want to keep data over multiple clients i suggest to store it in a table
ad 2. I also need a static function for this
you can use databasemanager.acquirelock() to lock the records in this table.
Hope this helps,
Rob
rgansevles:
Erik,ad 1. I need a Context/Application-scoped variable
All code and variables are running within a client, if you want to keep data over multiple clients i suggest to store it in a tablead 2. I also need a static function for this
you can use databasemanager.acquirelock() to lock the records in this table.Hope this helps,
Rob
Instead of using the database resource, I think this can be done through client and server plugin.
sure, you could do this through a client/server plugin as well, but what are you actually trying to achieve? Creating a plugin for this sounds like a bit of overkill, but I might be wrong.
Paul
pbakker:
sure, you could do this through a client/server plugin as well, but what are you actually trying to achieve? Creating a plugin for this sounds like a bit of overkill, but I might be wrong.Paul
A context-scope or application-scope variable can share information to all clients. In my case, I need to store concurrent number of users and the information of each user in that variable. I don’t think using the database resource to store logged in users is the best way to do this. We have complicated business rules attached to this which is the reason I cannot use Servoy’s built-in method, application.getClientCountForInfo.
Do you have a tutorial on how to make a client/server plugin? Thanks for the help.
The best tutorials on creating plugins in general are hosted on ServoyForge: https://www.servoyforge.net/projects/tutorials-stuff
As for specific client-server plugins: Don’t know if those tutorials go into depth on that topic, but you can always have a look at the mail plugin: it’s a pretty straight forward client-server plugin. If you are already up to speed in Java (which sounds like you do), you should be able to figure out the details involved in a few minutes.
Paul
pbakker:
The best tutorials on creating plugins in general are hosted on ServoyForge: https://www.servoyforge.net/projects/tutorials-stuffAs for specific client-server plugins: Don’t know if those tutorials go into depth on that topic, but you can always have a look at the mail plugin: it’s a pretty straight forward client-server plugin. If you are already up to speed in Java (which sounds like you do), you should be able to figure out the details involved in a few minutes.
Paul
Thanks very much for this. The plugin works in the development already.