Session Triggers for non db field

Dear Friends,

Has anyone managed to change default flag values using session triggers? The trick is its a variable and not a field.

TIA.
 

RealHeavyDude

Well-Known Member
It's not clear to me what it is that you try to achieve.

Is it that you want to change the value of a variable depending on some event in your application? If that's the case I would have a look at PUBLISH/SUBSCRIBE - given that you use at least Progress V9 ...

Heavy Regards, RealHeavyDude.
 
RHD Thanks.

I am trying to set values ie flag thru session trigger without touching the original source. if the user changes the value from yes to no then put it back to yes.

Help is appreciated.
 

RealHeavyDude

Well-Known Member
You can specify session triggers for CREATE/WRITE/DELETE and replication events for each database table (not sure about TEMP-TABLES - never have tried it), but there are some things you need to consider:

  • If database triggers are defined in the data dictionary they must be flagged accordingly so that they can be overriden.
  • Database triggers do fire at the end of the buffer scope which must not necessarily be the end of the transaction scope - so they might fire at times you don't expect them do.
  • Generally such triggers are not considered to be best practice as they make the business logic intransparent.
  • And, last but not least, there is a DISABLE TRIGGERS statement which is used during dump and load from the data dictionary but can be incorporated in any other program.
This is an example of what you could do in such a trigger:
TRIGGER PROCEDURE FOR WRITE OF <yourTable> OLD BUFFER o_<yourTable>.

IF <yourTable>.<yourField> THEN ASSIGN <yourTable>.<yourField> = FALSE.
Heavy Regards, RealHeavyDude.
 

oetalker

New Member
on leave anywhere do:
if self:name = "aa" then do:
if self:screen-value = "yes" then
self:screen-value = "no".
end.
end.
run org.p

and your org.p is...
def var aa as log.
def var bb as c.
form aa bb with frame f_aa.
update aa bb with frame f_aa.
 
Top