# Multiple users/clients editing/viewing single databse

**URL:** <https://forum.inductiveautomation.com/t/multiple-users-clients-editing-viewing-single-databse/38473>\
**Category:** Ignition\
**Tags:** database, ignition80, vision, perspective\
**Created:** [September 8, 2020, 2:31pm UTC](https://forum.inductiveautomation.com/t/multiple-users-clients-editing-viewing-single-databse/38473 "2020-09-08T14:31:43Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![jlandwerlen](https://avatars.discourse-cdn.com/v4/letter/j/bc8723/32.png) [@jlandwerlen](https://forum.inductiveautomation.com/u/jlandwerlen)\
**Post date:** [September 8, 2020, 2:31pm UTC](https://forum.inductiveautomation.com/t/multiple-users-clients-editing-viewing-single-databse/38473/1 "2020-09-08T14:31:43Z")

</div>

For situations where multiple clients/users can edit a table in a database, what is best practice for either not allowing multiple users at once, or a way to refresh/sync the data after one user makes changes?

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [September 8, 2020, 3:36pm UTC](https://forum.inductiveautomation.com/t/multiple-users-clients-editing-viewing-single-databse/38473/2 "2020-09-08T15:36:40Z")

</div>

Broadcast messages using system.util.sendMessage(). Include in the payload the table and the primary key value(s) so that each client that is simultaneously editing can intelligently respond: Ignore if a different table, refresh underlying data if a different row of same table, warn if same row. Something like that.

I like to have my DB editing screens work on a batch (one row or a limited set of rows) with changes held in the client until save is pressed, with color coding of changes made. In such a setup, other people’s changes can be blended in to the display and conflicts shown in another color.

If you are really strict, those messages could including the client ID and/or user name for display on the other clients, and perhaps potential conflicts could be reported back.

---

<div class="post-metadata">

**Author:** ![jlandwerlen](https://avatars.discourse-cdn.com/v4/letter/j/bc8723/32.png) [@jlandwerlen](https://forum.inductiveautomation.com/u/jlandwerlen)\
**Post date:** [September 8, 2020, 3:42pm UTC](https://forum.inductiveautomation.com/t/multiple-users-clients-editing-viewing-single-databse/38473/3 "2020-09-08T15:42:14Z")

</div>

> [@pturmel](#):
>
> I like to have my DB editing screens work on a batch (one row or a limited set of rows) with changes held in the client until save is pressed....

I do the same, usually only one row at a time.

> [@pturmel](#):
>
> ...with color coding of changes made...

How do you normally accomplish this, simply comparing datasets, one for selected data and one for changes?

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [September 8, 2020, 3:52pm UTC](https://forum.inductiveautomation.com/t/multiple-users-clients-editing-viewing-single-databse/38473/4 "2020-09-08T15:52:14Z")

</div>

I bring the source data into each editable field in a `Raw` custom property. When no edits have started, propertyChange events on `Raw` are just copied over to the real entry field. Another custom property, a boolean `Dirty`, has an expression comparing the two properties. ‘Dirty’ drives the color coding.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [September 8, 2020, 3:53pm UTC](https://forum.inductiveautomation.com/t/multiple-users-clients-editing-viewing-single-databse/38473/5 "2020-09-08T15:53:12Z")

</div>

When editing directly in a table, I bring the source data to a `Raw` dataset property and color-code from that.

---

<div class="post-metadata">

**Author:** ![jlandwerlen](https://avatars.discourse-cdn.com/v4/letter/j/bc8723/32.png) [@jlandwerlen](https://forum.inductiveautomation.com/u/jlandwerlen)\
**Post date:** [September 8, 2020, 4:15pm UTC](https://forum.inductiveautomation.com/t/multiple-users-clients-editing-viewing-single-databse/38473/6 "2020-09-08T16:15:37Z")

</div>

Are your editing areas separate screens/windows? So, they can’t select a different row after they start making changes?

I sometimes have the editable fields on the same window as the table they select which row to edit. The issue here is they can select a different row unless you prevent that, which I started doing recently. I’m trying to prevent less mouse clicks. I’m not a huge fan of editing within the table, especially since there are issues with dropdowns (reported this to IA last week.)

I was thinking about using messages for multiple users. Thanks for the tips.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [September 8, 2020, 4:43pm UTC](https://forum.inductiveautomation.com/t/multiple-users-clients-editing-viewing-single-databse/38473/7 "2020-09-08T16:43:28Z")

</div>

> [@jlandwerlen](#):
>
> Are your editing areas separate screens/windows?

I usually do a side-by-side. Starting edits disables the table/list of rows until save/cancel.

---

<div class="post-metadata">

**Author:** ![jlandwerlen](https://avatars.discourse-cdn.com/v4/letter/j/bc8723/32.png) [@jlandwerlen](https://forum.inductiveautomation.com/u/jlandwerlen)\
**Post date:** [September 8, 2020, 4:55pm UTC](https://forum.inductiveautomation.com/t/multiple-users-clients-editing-viewing-single-databse/38473/8 "2020-09-08T16:55:43Z")

</div>

> [@pturmel](#):
>
> Starting edits disables the table/list of rows until save/cancel.

Great, that's exactly what I ended up dong as well.

---

<div class="post-metadata">

**Author:** ![jlandwerlen](https://avatars.discourse-cdn.com/v4/letter/j/bc8723/32.png) [@jlandwerlen](https://forum.inductiveautomation.com/u/jlandwerlen)\
**Post date:** [September 14, 2020, 2:17pm UTC](https://forum.inductiveautomation.com/t/multiple-users-clients-editing-viewing-single-databse/38473/9 "2020-09-14T14:17:12Z")

</div>

> [@pturmel](#):
>
> Broadcast messages using system.util.sendMessage(). Include in the payload the table and the primary key value(s) so that each client that is simultaneously editing can intelligently respond: Ignore if a different table, refresh underlying data if a different row of same table, warn if same row. Something like that.

It's requested by the end user they don't want multiple people to even be on the same window at the same time. They would entertain the idea that the window be read only. So, curious how to manage this best. Use client/gateway tags to keep track?

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [September 14, 2020, 3:03pm UTC](https://forum.inductiveautomation.com/t/multiple-users-clients-editing-viewing-single-databse/38473/10 "2020-09-14T15:03:56Z")

</div>

I’ve never done that. Certainly need something in the gateway to moderate access. Will be a nightmare to manage broken connections or sudden client shutdown. I strongly recommend against a window lockout approach.

---

<div class="post-metadata">

**Author:** ![jlandwerlen](https://avatars.discourse-cdn.com/v4/letter/j/bc8723/32.png) [@jlandwerlen](https://forum.inductiveautomation.com/u/jlandwerlen)\
**Post date:** [September 14, 2020, 3:38pm UTC](https://forum.inductiveautomation.com/t/multiple-users-clients-editing-viewing-single-databse/38473/11 "2020-09-14T15:38:31Z")

</div>

What would be your approach, to manage as they accept edits? Still, how do you know who was there first? I don’t want last wins, I want first wins.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [September 14, 2020, 4:20pm UTC](https://forum.inductiveautomation.com/t/multiple-users-clients-editing-viewing-single-databse/38473/12 "2020-09-14T16:20:45Z")

</div>

> [@jlandwerlen](#):
>
> I want first wins.

How do you define first? By that I mean, how long or what criteria to you use to decide another edit is allowed? One minute? One hour? Something changing in the process?

Last wins is unambiguous, and if a user has permission to edit, why shouldn't they be allowed? Whether they were first or last into that window?

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [September 14, 2020, 4:24pm UTC](https://forum.inductiveautomation.com/t/multiple-users-clients-editing-viewing-single-databse/38473/13 "2020-09-14T16:24:27Z")

</div>

As for managing the data, I think notification of others’ changes while in the window is sufficient. Don’t make arbitrary barriers to getting a job done.

---

<div class="post-metadata">

**Author:** ![jlandwerlen](https://avatars.discourse-cdn.com/v4/letter/j/bc8723/32.png) [@jlandwerlen](https://forum.inductiveautomation.com/u/jlandwerlen)\
**Post date:** [September 14, 2020, 4:49pm UTC](https://forum.inductiveautomation.com/t/multiple-users-clients-editing-viewing-single-databse/38473/14 "2020-09-14T16:49:03Z")

</div>

> [@pturmel](#):
>
> > [@jlandwerlen](#):
> >
> > I want first wins.
> 
> How do you define first?

Exactly my point for asking the question..If I knew, I wouldn't be posting. 🙂

> [@pturmel](#):
>
> Last wins is unambiguous, and if a user has permission to edit, why shouldn't they be allowed? Whether they were first or last into that window?

Customer request, which I always try to accommodate.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [September 14, 2020, 4:53pm UTC](https://forum.inductiveautomation.com/t/multiple-users-clients-editing-viewing-single-databse/38473/15 "2020-09-14T16:53:35Z")

</div>

> [@jlandwerlen](#):
>
> Customer request, which I always try to accommodate.

Yes, but the customer can be asked to define exactly what they want. When they are asking for something difficult (or impossible), the effort to define it can expose the money pit they are about to fall in.

---

<div class="post-metadata">

**Author:** ![jlandwerlen](https://avatars.discourse-cdn.com/v4/letter/j/bc8723/32.png) [@jlandwerlen](https://forum.inductiveautomation.com/u/jlandwerlen)\
**Post date:** [September 14, 2020, 5:09pm UTC](https://forum.inductiveautomation.com/t/multiple-users-clients-editing-viewing-single-databse/38473/16 "2020-09-14T17:09:03Z")

</div>

Ok, we can leave it there then, not really interested in silly debates.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [September 14, 2020, 5:26pm UTC](https://forum.inductiveautomation.com/t/multiple-users-clients-editing-viewing-single-databse/38473/17 "2020-09-14T17:26:45Z")

</div>

I wouldn’t call it a debate. It’s just that what your customer wants is rather _ **difficult** _.

---

<div class="post-metadata">

**Author:** ![jlandwerlen](https://avatars.discourse-cdn.com/v4/letter/j/bc8723/32.png) [@jlandwerlen](https://forum.inductiveautomation.com/u/jlandwerlen)\
**Post date:** [September 24, 2020, 7:19pm UTC](https://forum.inductiveautomation.com/t/multiple-users-clients-editing-viewing-single-databse/38473/18 "2020-09-24T19:19:24Z")

</div>

I’m just getting back around to this. I would like to simplify things and give a notice when multiple users are editing the same thing. I have things kind of working but have an issue.

I have a tree view where they select what they want to edit. I get an Id from this. On this Id’s property change event, I send out a client message. I send out the Id of the tree view, the client id and project name. In the client message I determine if they are on the same window, if not I move on. If they are, I again grab the tree view Id and compare the client Ids.

What this gets me is a notification on the client that didn’t just make a new selection, the other client(s) will get the message. My goal is for all clients on the same Id to get the message. I have played around with a few things and just not making headway. Any advice on this?

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [September 24, 2020, 8:08pm UTC](https://forum.inductiveautomation.com/t/multiple-users-clients-editing-viewing-single-databse/38473/19 "2020-09-24T20:08:01Z")

</div>

Sounds like you need some kind of cache of what client Ids have navigated to what tree Ids.

---

<div class="post-metadata">

**Author:** ![jlandwerlen](https://avatars.discourse-cdn.com/v4/letter/j/bc8723/32.png) [@jlandwerlen](https://forum.inductiveautomation.com/u/jlandwerlen)\
**Post date:** [September 24, 2020, 9:48pm UTC](https://forum.inductiveautomation.com/t/multiple-users-clients-editing-viewing-single-databse/38473/20 "2020-09-24T21:48:01Z")

</div>

I was able to get what I need by cascading messages. I tested with 3 clients and it will display a message box for each client that is trying to edit the same thing. Only issue, if a user doesn’t acknowledge the message box and another client repeatedly selects the same ID it will blast message boxes for each occurrence. Any elegant way to know if a message box is opened and if it is don’t allow another one?

[Next page](https://forum.inductiveautomation.com/t/multiple-users-clients-editing-viewing-single-databse/38473.md?page=2)
