Home Information PDF Documents EULANDA Handbooks Training Book's corner Download Contact us Table of Contents About us

Glossary

Password needed Newsgroup

Remote Support system

SQL Events (SQL API)

Back | Level back

This described functionality has a provisional status and serves only the evaluation purpose. Changes are still possible at all described aspects. The release of this functionality is planned for EULANDA Version3.0.

Problem definition

Over triggers a multiplicity of events can be intercepted and separately treated. It is possible to accomplish special examinations by storing a address or to log changes at a file. Triggers however always work on table-level. Thus the possible operational area is limited to those events, those primarily a table concerns respectable the creation, a changing and deletion one or several data records. Complex procedures - for example converting an order into an delivery note - can be seized only with difficulty. In order to remain with the example: When converting an order into a delivery note some single actions are accomplished within the transaction.

  • Put on the delivery note header
  • Put on the positions or part positions
  • if necessary examination of the credit limit
  • Set the order status
  • Fill the conversion matrix between order positions and delivery note positions
  • If necessary creation of titles, which are used in the order
  • etc..

This listing is exemplary and not complete. The action which can be accomplished vary from a EULANDA® version of the text. Surely one could write a trigger, which accomplishes user defined actions when changing the order status. But one cannot guarantee that at this time already all other actions were accomplished. You cannot be save for example that all delivery note positions are put on. Around this limitation of the trigger concept to meet EULANDA® a new class of events introduces on sever level:

Server-lateral events:

Event id Event name Remark
10000 AfBuchen.OnSuccess Order book
10003 AfEdit.OnSuccess Order far-seize
10004 AfStornoBuchung.OnSuccess Order reservation cancel
10005 TraAfLf_DoJob.OnSuccess Transformation of an order into a delivery note
10006 TraLfRe_DoJob.OnSuccess Transformation of a delivery note in a calculation

Procedure prototype

The treatment of such an event is implemented as procedure. The procedure must be strictly according to the following pattern developed:

CREATE PROC cn_user_evtXXX
  @SubsId int,
  @ObjType char(4),
  @ObjId int
AS

SET NOCOUNT ON



  RAISERROR ('Error message',16,1)
  RETURN -1

  RETURN 0

Example

Over following SQL code a price auditing is implemented, which prevents a booking of the order on falling below the purchase price.

CREATE PROC cn_user_evtAfBuchen_EkPruefung
  @SubsId int,
  @ObjType char(4),
  @ObjId int
AS

SET NOCOUNT ON

DECLARE @Pos int
SELECT TOP 1 @Pos = afp.PosNummer 
FROM dbo.AuftragPos afp
WHERE afp.KopfId = @ObjId AND afp.Basis > afp.VkRab

IF @@ROWCOUNT > 0
BEGIN
RAISERROR('The purchase price was fallen below in position %d',16,1,@Pos)
RETURN -1
END ELSE RETURN 0

GO

INSERT cnEventSubscriber (EventId, Vendor, ProcName)
VALUES(10000, 'USER', 'cn_user_evtAfBuchen_EkPruefung')