Session Triggers

TColeman

Member
I have a date field in my database that when that field is changed I need to update a status that is displayed to a user. This status is up and running 24/7. I understand that I need to use a Session Trigger but where do I need to put this code? In the main application?

I am using V9.1 on a Windows 2000 server.

Thanks,

Terri
 

rich_t

New Member
Unless you have a timer loop, on your status application, that periodically checks for that date field changing you won't know because your application is generally passive, responding only to triggers that are local to the application that is running.

Have you tried using a PStimer OCX in your status application?

HTH
Rich
 

rich_t

New Member
If the module of your application that writes the changed date field back to the DB is ALWAYS on the same client and within the same session then its possible to pass values to your update procedure, from the DB trigger or session trigger, if its being run persistently .. failing that you will definitely need some sort of timer routine to check for it changing.

Cheers
Rich
 

Chris Kelleher

Administrator
Staff member
Terri-

In the procedure that updates the date, you could have a trigger to update the status field in the database:

<BLOCKQUOTE><font size="1" face="Arial, Verdana">code:</font><HR><pre>
ON ASSIGN OF myDate
DO:
myStatus = "New Status".
END.
[/code]

Then in the program that displays the status, you could use the PSTimer OCX as Rich suggested, or use a simple time-out value on your WAIT-FOR statement:

<BLOCKQUOTE><font size="1" face="Arial, Verdana">code:</font><HR><pre>
PROCEDURE DisplayStatus:
DISPLAY MyStatus.
END PROCEDURE.

REPEAT:
RUN DisplayStatus IN THIS-PROCEDURE.
WAIT-FOR CLOSE OF THIS-PROCEDURE PAUSE 60.
PROCESS EVENTS.
END.
[/code]

Is is just some sample (ie untested) code, but hopefully it can point you in the right direction
smile.gif


-Chris


------------------
Chris Schreiber
ProgressTalk.com Manager
chris@fast4gl.com
 

TColeman

Member
Okay guys be patient with me.....

What is happening is a C++ service running in the background is updating a status table as a status is received. When the time field in the status table changes I want that event to trigger the status in the application to update so the user can see that status reporting is happening. Why can't a simple trigger in the database accomplish that?

Like:

ON ASSIGN OF table.NewStatusTime DO:
RUN UpdateStatusScreen.p
END.

Thanks,

Terri
 
Top