define trigger on entity level
Author: i2stiller@gmx.de (istiller)
Hi freaks Did anyone of you use the define trigger on entity level? I just did so and got a strange listing (9.7.04)
What the ... is this defintion for entity FIELD.MODEL? BTW: And, this defines are not local to the entity :-( Background: We do have different 'types' of entities in a component, like visible entities or auxiliary entities. I looking for a simple way to tell the globale procs (for read or write or ...) which kind of entity it is. For the whole component, this could be done by the DEFINE-trigger and some coding in a general INIT-Operation. But how to do this for entities? a) the DEFE trigger should do what it have to do. And this local to the entity b) I need some kind of INIT for the entity (collection) Any ideas? BTW: This should not interference the rest of the code, as my colleagues don't like to change there code or see changed code :-) Ingo

) So back to your problem. What you see is correct: your #include is process twice because it is actually defined twice: at modeled-level AND at component/local level. To avoid this situation is not to change the inherited code that you see in the Defines trigger at component level, but to first complete clear that trigger and ONLY put your local code in there. The inherited code WILL get inherited at compile time, even if you do not see it in the UDE. So for type-2 triggers, why do we compile the modeled code also? That has to do with the inheritance type, we want to inherit per Proc module declaration, but to get the declarations, we need to compile first. Module declaration might get included (#include), get generated (#for), or conditionally declared (#if), or even undeclared (#undeclare). So we MUST compile first, and then resolve inheritance. I hope this explains it and allows you to figure out what to do. If not, reply some more. Regards, Gerton (Software Architect Uniface Lab)
But maybe out there, some will read my posts. Increase: UnifAce will read it And -fingers crossed - UnifAce will answer or fix the problem
Ingo
In each define-trigger for groups on model level (TPLACTUAL.UCGROUP) write an #include into the trigger #include STD_DEFE Create a componente and put some #defines before the include into the define trigger (TPLACTUAL.UXGROUP) #define DOSOMETHING #include STD_DEFE How often will STD_DEFE excuted on compilation? Not not once but twice If the include start with an guard like: #ifundefined STD_DEFE_GUARD #define STD_DEFE_GUARD #ifdefined DOSOMETHING #info somethingtodo #endif #endif what is the result? Yes, you guess it. #info will never reached Why? On first round, UnifACe includes the modell define-trigger: Guard is therefore armed Second step, the component define-trigger is "executed". But as the guard is armed .... So one need a two step guard to get this one to run. And as in documentation there is no hint about inheritance and the sequence of resolving the triggers, I do not trust UnifAce that model is always for component. As an consequence, the include will be executed two times. @UnifAce: a) Is there any way to stop UnifAce from resolving two times? b) is there and precompiler constant to check, if I am on model or component level? Ingo



