Table Name - Trigger Procedure

Hello Guys, hope you all are doing well.

My question is very basic but I am not getting any lead on this. I want to know the Table Name in trigger procedure and don't want to hardcode this.

Requirement: Need to implement a generic program for trigger procedures of all tables. If I hardcode the table name then I will have to hardcode that in all trigger procedures.

Regards,
Learner
 

Stefan

Well-Known Member
How are you planning on doing this (without an include), since the trigger procedure must start with a static:

Code:
trigger procedure for <event> of <table>.

We use a (generated) single line .p with the table name passed as a preprocessor to an include that does the actual work.
 
Hi Stefan, Thanks for your reply!

Yes, we don't want to change the first static line of trigger procedure. Just need to catch-up buffer name dynamically after the first static line (trigger procedure for <event> of <table>.). As we have buffer scope available in trigger procedure so I guess we should be able to get the buffer name dynamically.

Regards.
 
Hello Stefan, I am trying to access it in Delete trigger. Program-name seems not working for this purpose. Program-name(1) is giving .P name of trigger procedure and program-name(2) is returning below pop-up message:

---------------------------
Information
---------------------------
C:\Progress\OpenEdge\bin\p68799_Untitled2.cmp
---------------------------
OK
---------------------------

Regards
 

Stefan

Well-Known Member
So program-name(1) is usable, you just need to ensure that (part of) the name of your trigger procedure matches the name of the table it is for. Our delete triggers are all named <module>/td/td<table>.p - so can easily get the name of the table the trigger is for.
 
Yes Stefan, agreed. We can get the table name easily if trigger names are in sync with table name. I just need to cross check this for all delete triggers. Thanks for your help!

Regards,
Learner
 
Top