Joost
The old problem - finding out if something has changed in the object
interface
in sql triggers you can refer to the stored value
- oops someone will have to assist - I cannot remember the syntax
in Objects not so easy
two ways
in the %OnOpen call back grab the property values and stuff them into
a transient property of the class
you can then compare the saved value with the transient value
In the %OnAddToSaveSet
use SQL to get the stored data
eg
if 'insert {
set xID=..%Id()
set xStored=""
&sql(select property into :xStored from thisclass where %ID=xID)
if xStored'=..pProperty {
it's changed do the notify
}
}
Thats for a simple property changing data
if you want to be notified on the insert of a Task then it's easier
%OnAfterSave(insert)
{
if insert {
do the notify
}
}
Add this in the Task class not the Employee class - it's the task
that's being inserted
Not that these callbacks only work in the object projection - if you
want it via SQL then you have to do a trigger as well
Peter
On Fri, 30 Jul 2004 16:37:24 +0200, "Joost Verhoog"
<j.verhoog.AT.saltro.nl> wrote:
>I have an object (say Employee) that has a relationship (say Relationship
>Tasks As Task [ Cardinality = many, Inverse = Employee). Now I want to be
>notified when then relationship changes (say a task is added). Can I do
>that?
>
>I've tried:
>
>1) For Properties you have accessor methods (like TasksSet(Arg As Tasks))
>but these don't seem to work on Relationships.
>2) There are callback methods like %OnAfterSave, but when I use these I
>don't know the old value of the relationship, so I can't know if anything
>changed.
>
>Joost Verhoog
>
>PS. This is a great newsgroup. You're really helpfull! (And I try to be,
>too)
>