How to block access to a screen when it is already opened by another user?

How to block a screen when it is already opened by another user?

 

I would like to block the Access to a certain screen when it is already opene by another user. I made the following steps:

- create a cube with the Entity screen

- the screen gets an open trigger which checks if the cube already contains a value >= 1, if not the screen will be opened and the cube is set so 1, if yes the screen will be closed with a warning

- the screen gets a close trigger which sets the cube to 0

 

The last step is the Problem: If the open trigger checks that theres is already a value >=1 in the cube, the screen is closed and the close trigger is executed and the cube is set to 0.

If the user tries is again, or another user, he can open the screen, although it is already opened by somebody else.

 

Does anybody have a godd idea how to realize this Task?

 

Regard and thanks in advance

Tanja

Answers

  • Björn Reuber
    Björn Reuber Employee, Community Captain
    500 Likes Fourth Anniversary 100 Comments 5 Answers

    Hi,

     

    if you doesnt allow the user to open screens directly you can implement the logic directly in the procedure.

     

    Alternative: You use 2 lock cubes, one without user (general Lock) and one on user level (you need an user dimension):

    On open trigger:

    Check if general lock is set,

    if yes - Close screen

    if no - set general lock and set user lock

     

    On Close trigger:

    if user cube is set to 1 set  user cube and general cube to zero

     

    so the lock is only rejected from the user, who has opened the screen.

     

    BUT the whole logic only works until 2 people try to open the screen at the same time

     

    regards

    Björn

  • Tanja Kärcher
    Tanja Kärcher Active Partner
    Fourth Anniversary First Comment

    Hello Björn,

    thanks for your input. I impletmented the solution with two cubes in the way you suggested above. I works just fine.

    Regards

    Tanja

  • Hi Tanja Kärcher,

     

    also keep in mind to implement a way to remove the lock as administrator. Because there are several scenarios (e. g. loss of network connection, ...) where the user might not close the screen in the proper way and remove the lock.

     

    BR

     

    Sebastian