Skip to main content
Hi.

I can't find this information in the doc (most probably because of my english).

Is there a way to call the "parent" trigger when overriding it in a form ?

To be more clear, let's say I have an entity with some specific code in the trigger (for example the write trigger).

Then I have a form with this entity, and I want to add a specific code, but only when in this form.

A solution could be to copy the original trigger code and add what's needed. But by doing that I will duplicate code.

Another solution could be to add my specific code in the entity with a test, but it will mean to recompile all the forms with the entity.


So what I'm asking, is there a way to do something like this in an entity in a form

trigger write

  call MyEntity.trigger(write)
  do this
  do that
end

Thanks.

------------------------------
Jean-marc Salis
Mp Services
Montauban Cedex FR
------------------------------
Hi.

I can't find this information in the doc (most probably because of my english).

Is there a way to call the "parent" trigger when overriding it in a form ?

To be more clear, let's say I have an entity with some specific code in the trigger (for example the write trigger).

Then I have a form with this entity, and I want to add a specific code, but only when in this form.

A solution could be to copy the original trigger code and add what's needed. But by doing that I will duplicate code.

Another solution could be to add my specific code in the entity with a test, but it will mean to recompile all the forms with the entity.


So what I'm asking, is there a way to do something like this in an entity in a form

trigger write

  call MyEntity.trigger(write)
  do this
  do that
end

Thanks.

------------------------------
Jean-marc Salis
Mp Services
Montauban Cedex FR
------------------------------
Hi 

It sounds like you might be looking for this
Precompiler Directives

Regards
Osman

------------------------------
Osman Shariff
------------------------------
Hi.

I can't find this information in the doc (most probably because of my english).

Is there a way to call the "parent" trigger when overriding it in a form ?

To be more clear, let's say I have an entity with some specific code in the trigger (for example the write trigger).

Then I have a form with this entity, and I want to add a specific code, but only when in this form.

A solution could be to copy the original trigger code and add what's needed. But by doing that I will duplicate code.

Another solution could be to add my specific code in the entity with a test, but it will mean to recompile all the forms with the entity.


So what I'm asking, is there a way to do something like this in an entity in a form

trigger write

  call MyEntity.trigger(write)
  do this
  do that
end

Thanks.

------------------------------
Jean-marc Salis
Mp Services
Montauban Cedex FR
------------------------------

I would typically use entity operations (either collection or occurrence as needed) and/or include procs for the shared code, e.g.

Example: calling an occurrence operation

On the entity:
Define OpWrite as an occurrence operation (see the Handles documentation).

Call it in trigger write.

On the form, create a variation that uses the shared operation

trigger write
    $occhandle()->OpWrite()
    ; do this & that
end


Example: using an include proc
Here the entity and form variation uses Include ProcScript defined in SYSTEM_LIBRARY::WRITE_LOGIC instead (it could be in another library).
Additional code would be added to the form, e.g.

trigger write
  #include WRITE_LOGIC
  ; do this & that
end
​If needed, you can use the precompiler #define #ifdefined or #ifundefined directives to add additional code only once.

A combination of both approaches could also be used.


Regards,

------------------------------
David Akerman
Principal Solution & Enablement Architect
Rocket Internal - Uniface
------------------------------
Hi.

I can't find this information in the doc (most probably because of my english).

Is there a way to call the "parent" trigger when overriding it in a form ?

To be more clear, let's say I have an entity with some specific code in the trigger (for example the write trigger).

Then I have a form with this entity, and I want to add a specific code, but only when in this form.

A solution could be to copy the original trigger code and add what's needed. But by doing that I will duplicate code.

Another solution could be to add my specific code in the entity with a test, but it will mean to recompile all the forms with the entity.


So what I'm asking, is there a way to do something like this in an entity in a form

trigger write

  call MyEntity.trigger(write)
  do this
  do that
end

Thanks.

------------------------------
Jean-marc Salis
Mp Services
Montauban Cedex FR
------------------------------
Hi,

we did it the same way as David.

In the Model Entity
trigger write
	$occhandle->OP_MODEL_WRITE()
	write
end
​
operation OP_MODEL_WRITE
	if ($dbocc = 0)
		CRE_DATE.<$entName> = $datim
		CRE_USER.<$entName> = $$KURZZEICHEN_SYSTEM 
	endif
	MOD_DATE.<$entName> = $datim
	MOD_USER.<$entName> = $$KURZZEICHEN_SYSTEM 
end

In the Form:

trigger write
	; do things before
	$occhandle->OP_MODEL_WRITE()
	; do things after
	write
end
​

Regards
Norbert

------------------------------
Norbert Lauterbach
Infraserv Gmbh & Co. Höchst Kg
Frankfurt DE
------------------------------
Hi.

I can't find this information in the doc (most probably because of my english).

Is there a way to call the "parent" trigger when overriding it in a form ?

To be more clear, let's say I have an entity with some specific code in the trigger (for example the write trigger).

Then I have a form with this entity, and I want to add a specific code, but only when in this form.

A solution could be to copy the original trigger code and add what's needed. But by doing that I will duplicate code.

Another solution could be to add my specific code in the entity with a test, but it will mean to recompile all the forms with the entity.


So what I'm asking, is there a way to do something like this in an entity in a form

trigger write

  call MyEntity.trigger(write)
  do this
  do that
end

Thanks.

------------------------------
Jean-marc Salis
Mp Services
Montauban Cedex FR
------------------------------
Thank you all for the different methods explained.

I didn't know it was possible to add an operation directly in the model, but it's cool it's possible

Regards,

------------------------------
Jean-marc Salis
Mp Services
Montauban Cedex FR
------------------------------