Jump to content
Sign in to follow this  
Henry Olive

Showing a warning form to some users

Recommended Posts

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
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

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

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

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×