Henry Olive 5 Posted February 16, 2022 I wish everyone a healthy day. When a part has arrived into our ware house I want to notify some users that the part has arrived I created a form which has all necessary fields regarding the arrived part (It gets the datas from Dispatch table's after post event) I need something like below Dispatch Table After Post Event If dm.DispatchDocType.asString <> 'IN' then Exit; If MatchText(dm.DispatchDocType.asString,['Normal', 'Rework']) then begin Users.First; While not Users.Eof do begin If UsersDepartment.asString = 'Planning' then Form1.Show // to releated user ??? Users.Next; end; end; Could someone please help ? Thank You Share this post Link to post
David Heffernan 2345 Posted February 16, 2022 Sounds like you need to build some messaging infrastructure in to your program. Share this post Link to post
Tom Chamberlain 47 Posted February 16, 2022 2 hours ago, David Heffernan said: Sounds like you need to build some messaging infrastructure in to your program. Agreed, we use a simple DataSnap service for something like this so no 3rd party things are needed as long as you have the enterprise or better version. Create a DataSnap process to run as a Windows service or Linux daemon to be the controller Clients starts and registers itself with the DataSnap service with a call back event so the service can talk back to the client The process that post to the dispatch table also connects to the DataSnap service but to only send a message to the DataSnap service that the record was posted The DataSnap service then sends a message to all or individual clients via the call back This call back is a JSON value so you can pass back whatever you want/need to the client, we pass back 'commands' with multiple other values. After you get it functioning you can add security and encryption if needed. Check here (it was not working for me) and here for some help. Share this post Link to post
qubits 20 Posted February 16, 2022 Multi-user DB App. If you don't need instant notification, could also add a User Messages table and add a record to each user that needs notification. Have the app check user messages once and awhile. Unless maybe you do want to create and display the forms in a loop and have them all on one screen? Share this post Link to post
Lajos Juhász 293 Posted February 16, 2022 Depending on the database you can try to use TFDEventAlerter (the docwiki at embarcadero at the moment I cannot check for supported databases). Share this post Link to post
Guest Posted February 16, 2022 I would refrain creating a complete new "infrastructure" for this (messaging service, http).... Either "poll" a table where your server/SPs add new items. This table could also have "userId". If polling (every X seconds) is detrimental to performance, server resources, use an event (if you have such a RDBMS). qubits and Lajos already said. I want to add, that you choose either polling OR events OR both. The important thing is to have transaction handling ok so that each client can get the pertaining info only once. HTH /Dany Share this post Link to post
mvanrijnen 123 Posted February 16, 2022 Or in case of Interbase database, you could fix something with changeviews also. Link1: ChangeViews - InterBase Link2: InterBase (embarcadero.com) (currently not working) Share this post Link to post
Henry Olive 5 Posted February 18, 2022 Thank you so much David, Tom, Qubits, Lajos, Dany, Mvanrijnen Share this post Link to post