Using TIBEvents

Hi Experts,
                  I try to use a TIBEvents component but I don't know what kind of events are to be used. I have choosen logical events (for example EMP_NO>100) for the Events property (EventAlerter Events window) and I don't get event report using the procedure as follows:

procedure TDMDatamodul.IBEvents1EventAlert(Sender: TObject;
  EventName: String; EventCount: Integer; var CancelAlerts: Boolean);
begin
   MessageDlg ('Event: '+EventName, mtInformation, [mbOK], 0);
end;

This is placed in a DataModule so first I had to insert the "uses Dialogs" to the used units to be able to use here the message dialog box.

An other question: How can I delete event from this list (EventAlerter Events window)?

with best regards

Janos
LVL 10
kacorretiredAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
BAlexandrovConnect With a Mentor Commented:
You have some invalid characters in post_event line.
It must be:
POST_EVENT "NEW_EMPL";


Regards,
Bojidar Alexandrov
0
 
BAlexandrovCommented:
This is not the purpose of events at all. Please read the pdf - Language Reference

Bojidar Alexandrov
0
 
kacorretiredAuthor Commented:
Hi Bojidar,
I've found in the IB6EmbeddedSQLGuide.pdf/Chapter 11 Working with events interesting things, thanks for the idea. But could you send me an example how to create such an event.
I tried to insert this trigger into Employee.gdb in Program Files\Common Files\Borland Shared\Data

SET TERM !! ;
CREATE TRIGGER POST_NEW_EMPL FOR EMPLOYEE
   ACTIVE
   AFTER INSERT
   POSITION 0
   AS
      BEGIN
         POST_EVENT ’NEW_EMPL’;
   END
!!
SET TERM ; !!

but I got an error message:
 
Dynamic SQL Error
SQL error code = -104
Unexpected end of command

This is an example from Embedded Sql Guide P.234.

wbr Janos
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
kacorretiredAuthor Commented:
Dear Bojidar,
my last question is where (in which part) can I register my interest for a given event for ex. for NEW_EMPL

wbr

Janos
0
 
BAlexandrovCommented:
TEventAlerter - as you have begin initially.
Insert in it NEW_EMPL and set a handler to it - see its events (ov TEventAlerter)
0
 
kacorretiredAuthor Commented:
Bojidar,
I used the Employee.gdb from the examples (\common files\borland shared\data). As I see in IBConsole Employee table has two triggers: SET_EMP_NO and SAVE_SALARY_CHANGE, so this events exist. I use this events in the IBEvents1.Events property but the IBEvents1EventAlert procedure (see above) don't give a message dialog box whether I use the Commit or don't use. Any more idea?

wbr Janos
0
 
BAlexandrovCommented:
Events are not triggers!
Make your trigger above to post POST_EVENT "NEW_EMPL";
and catch NEW_EMPL in Event Alerter
0
 
kacorretiredAuthor Commented:
To remain compatible with the earlier settings I used the code as follows:
SET TERM ^ ;
CREATE TRIGGER POST_NEW_EMPL FOR EMPLOYEE
ACTIVE BEFORE INSERT POSITION 0
AS
BEGIN
    POST_EVENT "NEW_EMPL";
END
SET TERM ; ^

but it gives an error message:

Dynamic SQL Error
SQL error code = -104
Token unknown - line 7, char -1
SET
Statement: CREATE TRIGGER POST_NEW_EMPL FOR EMPLOYEE
ACTIVE BEFORE INSERT POSITION 0
AS
BEGIN
  POST_EVENT "NEW_EMPL";
END
SET TERM ;

I can't understand. I feel it is a tree near the forest and this tree drapes the whole forest and I can't see the forest. Everything is dark...

Janos
0
 
BAlexandrovCommented:
SET TERM ^ ;
CREATE TRIGGER POST_NEW_EMPL FOR EMPLOYEE
ACTIVE BEFORE INSERT POSITION 0
AS
BEGIN
   POST_EVENT "NEW_EMPL";
END^
SET TERM ; ^
0
 
BAlexandrovCommented:
in Event Alerter register this event - NEW_EMPL
0
All Courses

From novice to tech pro — start learning today.