PROBLEM
I’m not sure how to describe this problem.
So, after setting up the NG stuff such that you put the URL in a browser to access it client side. That person is now a ‘user’ right? And when multiple people are accessing the NG, those are all technically different users with their own clientside NG.
Alright, now lets say 1 user does something on a page such that a Form event is triggered for them, something via Datachange. And what if this event is important for that form, perhaps related to an error status.
QUESTION
This begs the question of, do other users receive form events? Form events being called on one users clientside.
And then, how do you send a local NG client’s form event to all other users, if possible? Specifically the events related to a users actions, like datachange of a record and such.
THEORY
Do I have to set something up so form events are sent to other users? Is ‘users’ the right word? Basically people using the same instance of NG from their own browser, making database changes to a record that shoots off a form event… How do I sent that event to everyone else that is browsing the same form instance? Is there something I’m missing that needs to be setup, either client side or server side? Or does NG not work like that to begin with.
The Servoy platform has a nice feature called Data Broadcasting, which will update the data cache across all client sessions. This means that 2 clients looking at the same record will always see the same point-of-truth. You don’t have to do anything to enable this.
Per your specific question: No, UI events are not shared between clients. What happens on a client screen (apart from data broadcasts, is limited to that session)
The Servoy platform has a nice feature called Data Broadcasting, which will update the data cache across all client sessions. This means that 2 clients looking at the same record will always see the same point-of-truth. You don’t have to do anything to enable this.
Per your specific question: No, UI events are not shared between clients. What happens on a client screen (apart from data broadcasts, is limited to that session)
Hmmm yes the data is definitely being broadcasted instantly. The problem is the form events then.
So let’s say User-1 changes something on a form & User-2 is also viewing the same form. User-1 gets the Form Events from that datachange, this triggers elements on the form to change. In this case, it’s related to an error that must be fixed before they leave the page so navigation is disabled. However, since User-2 didn’t get the Form Event so they can still navigate around even though there was an error.
I’m curious if ya have any ideas on how to make sure both User-1 and User-2 get the form change from the datachange.
An idea I have is by adding more checks to the data for other form events, so that the form would eventually update.
Another would be locking a page out from others viewing it if it’s “in use”, not sure if that’s possible though. I’ll have to watch the webinar to see if this is mentioned.
I don’t understand. Why would you want user 2’s experience to be tied to something user 1 is doing?! …unless they actually commit the changed data in the DB.
In the case of the validation, if the data is not saved yet, then user 2 should not be bothered with something user 1 is doing. Each has their own stateful session.
If I understand right, you want something like this (this example is a bit artificial):
User 1 ( a manager) edits form, user 2 (a sales person) is looking at the same record, let’s say a Customer’s account.
The Customer owes money and has reached the credit limit so there is a message on both users’ screens that the customer cannot get more credit, so the sales person has asked the manager to override.
User 1 changes the credit limit or adds a payment to the user’s account so the message disappears on User 1’s screen.
At this point the customer has more credit but the sales person does still see the message.
To get the message to also instantly disappear from the sales person’s screen you need to put it in a database field and display that field on your form. The field can include styling.
In your database table on Servoy you hook up a method to your onUpdateEvent that updates the message if the credit limit changes or payment is added.
This way Servoy will broadcast the change for you.
swingman:
If I understand right, you want something like this (this example is a bit artificial):
User 1 ( a manager) edits form, user 2 (a sales person) is looking at the same record, let’s say a Customer’s account.
The Customer owes money and has reached the credit limit so there is a message on both users’ screens that the customer cannot get more credit, so the sales person has asked the manager to override.
User 1 changes the credit limit or adds a payment to the user’s account so the message disappears on User 1’s screen.
At this point the customer has more credit but the sales person does still see the message.
To get the message to also instantly disappear from the sales person’s screen you need to put it in a database field and display that field on your form. The field can include styling.
In your database table on Servoy you hook up a method to your onUpdateEvent that updates the message if the credit limit changes or payment is added.
This way Servoy will broadcast the change for you.
Hope this helps,
Hmmm, so if I’m understanding right, setting up a Database event (not Form) will mean that I can update the message from when the database itself changes.
I would use onRecordUpdate in the scenario above, because I want to modify a column in the customers table based on other values in the customers table.
If you trigger the change in customers from payments when adding a new payment, you can use either of the two events. Maybe try afterRecordInsert in this case.
Let’s assume your onRecordUpdate in Customers checks the money owed to calculate the message. In the afterRecordInsert you can trigger an update on the customers table any simply updating the modified_timestamp on the related customer and saving. This triggers the onRecordUpdate in customers…
something like:
if(utils.hasRecords(my_payment.your_relation_from_payments_to_customer) {
var customer = my_payment.your_relation_from_payments_to_customer.getRecord(1);
customer.modified_timestamp = new Date();
databaseManager.saveData(customer);
}
It all depends what you are doing – you want to avoid too many other updates cascading out the initial change, so one may work better than the other.
I would use onRecordUpdate in the scenario above, because I want to modify a column in the customers table based on other values in the customers table.
If you trigger the change in customers from payments when adding a new payment, you can use either of the two events. Maybe try afterRecordInsert in this case.
Let’s assume your onRecordUpdate in Customers checks the money owed to calculate the message. In the afterRecordInsert you can trigger an update on the customers table any simply updating the modified_timestamp on the related customer and saving. This triggers the onRecordUpdate in customers…
something like:
if(utils.hasRecords(my_payment.your_relation_from_payments_to_customer) {
var customer = my_payment.your_relation_from_payments_to_customer.getRecord(1);
customer.modified_timestamp = new Date();
databaseManager.saveData(customer);
}
It all depends what you are doing – you want to avoid too many other updates cascading out the initial change, so one may work better than the other.
I see. I just watch to check when a number value is modified in my case. So I think afterRecordUpdate should work for me.
Thank you for explaining this! I’ll reply again if I can’t figure out how to set it up.