Skip to main content

Hi All,

Im back to MV-World after a 20-year break. Formerly i was developing an application with advanced Pick / SB+.

I want to activate Database triggers on a UV Database for some UV Datafiles to get dependent tables updated.

But im struggling right at the beginning.

I created  the following:

FILE TEST.TRIGGER FILE TYPE 18

BAISC SUBROUTINE B.TESTTRIGGER with the needed parameters.

After that I try to activate the Trigger with 
CREATE TRIGGER TESTTRIGGER BEFORE INSERT OR UPDATE TEST.TRIGGER B.TESTTRIGGER

-> I Get the message TEST.TRIGGER unexpected.

I thought that I have to convert the file to SQL Table befor so i tried the following command:

CONVERT.SQL TEST.TRIGGER

-> I Get the Message: Can't run CONVERT.SQL: 'UV11TEST-TL\\Administrator' is not an SQL User

So i logged in as Administrator User and tried:

GRANT DBA TO t.ludwig or GRANT DBA TO Administrator 

-> I Get the message: UniVerse/SQL: "UV11TEST-TL\\Administrator" is not an SQL user.  

I think the problem is to get the first user as an SQL User.
In the Help-File i found that NT AUTHORITY\\system gets registered as SQL user during install, but how do I use this user to Grant Access to other users?

Everey Idea is welcome...



------------------------------
Thomas Ludwig
System Builder Developer
Rocket Forum Shared Account
------------------------------

Hi All,

Im back to MV-World after a 20-year break. Formerly i was developing an application with advanced Pick / SB+.

I want to activate Database triggers on a UV Database for some UV Datafiles to get dependent tables updated.

But im struggling right at the beginning.

I created  the following:

FILE TEST.TRIGGER FILE TYPE 18

BAISC SUBROUTINE B.TESTTRIGGER with the needed parameters.

After that I try to activate the Trigger with 
CREATE TRIGGER TESTTRIGGER BEFORE INSERT OR UPDATE TEST.TRIGGER B.TESTTRIGGER

-> I Get the message TEST.TRIGGER unexpected.

I thought that I have to convert the file to SQL Table befor so i tried the following command:

CONVERT.SQL TEST.TRIGGER

-> I Get the Message: Can't run CONVERT.SQL: 'UV11TEST-TL\\Administrator' is not an SQL User

So i logged in as Administrator User and tried:

GRANT DBA TO t.ludwig or GRANT DBA TO Administrator 

-> I Get the message: UniVerse/SQL: "UV11TEST-TL\\Administrator" is not an SQL user.  

I think the problem is to get the first user as an SQL User.
In the Help-File i found that NT AUTHORITY\\system gets registered as SQL user during install, but how do I use this user to Grant Access to other users?

Everey Idea is welcome...



------------------------------
Thomas Ludwig
System Builder Developer
Rocket Forum Shared Account
------------------------------

Hi Thomas,

It looks like you don't have the syntax quite right for the CREATE TRIGGER command. The following is an example of mine that works.

CREATE TRIGGER FRED BEFORE INSERT OR UPDATE ON TRIGTEST FOR EACH ROW CALLING '*TRIGGERPROG';

The file name is TRIGTEST and the TRIGGER is using the globally catalogged program *TRIGGERPROG.

Thanks,

Neil



------------------------------
Neil Morris
Universe Advanced Technical Support
Rocket Software
------------------------------

Hi All,

Im back to MV-World after a 20-year break. Formerly i was developing an application with advanced Pick / SB+.

I want to activate Database triggers on a UV Database for some UV Datafiles to get dependent tables updated.

But im struggling right at the beginning.

I created  the following:

FILE TEST.TRIGGER FILE TYPE 18

BAISC SUBROUTINE B.TESTTRIGGER with the needed parameters.

After that I try to activate the Trigger with 
CREATE TRIGGER TESTTRIGGER BEFORE INSERT OR UPDATE TEST.TRIGGER B.TESTTRIGGER

-> I Get the message TEST.TRIGGER unexpected.

I thought that I have to convert the file to SQL Table befor so i tried the following command:

CONVERT.SQL TEST.TRIGGER

-> I Get the Message: Can't run CONVERT.SQL: 'UV11TEST-TL\\Administrator' is not an SQL User

So i logged in as Administrator User and tried:

GRANT DBA TO t.ludwig or GRANT DBA TO Administrator 

-> I Get the message: UniVerse/SQL: "UV11TEST-TL\\Administrator" is not an SQL user.  

I think the problem is to get the first user as an SQL User.
In the Help-File i found that NT AUTHORITY\\system gets registered as SQL user during install, but how do I use this user to Grant Access to other users?

Everey Idea is welcome...



------------------------------
Thomas Ludwig
System Builder Developer
Rocket Forum Shared Account
------------------------------

Also, the file need not be a SQL Table to be able to add the trigger.  Triggers can be added to regular UV files.



------------------------------
Neil Morris
Universe Advanced Technical Support
Rocket Software
------------------------------

Also, the file need not be a SQL Table to be able to add the trigger.  Triggers can be added to regular UV files.



------------------------------
Neil Morris
Universe Advanced Technical Support
Rocket Software
------------------------------

Thanks a lot, for the help.

-> Had to find out how to catalog globally but finaliy got the trigger to work.

Now I guess I have to learn a bit more about Triggers because I get the next error message after saving an entry in the triggered File in the SB+ Screen-Editor

I Will go through the Docs and try to find how the Subroutine should look like...

best Regards

Thomas



------------------------------
Thomas Ludwig
System Builder Developer
Rocket Forum Shared Account
------------------------------

Thanks a lot, for the help.

-> Had to find out how to catalog globally but finaliy got the trigger to work.

Now I guess I have to learn a bit more about Triggers because I get the next error message after saving an entry in the triggered File in the SB+ Screen-Editor

I Will go through the Docs and try to find how the Subroutine should look like...

best Regards

Thomas



------------------------------
Thomas Ludwig
System Builder Developer
Rocket Forum Shared Account
------------------------------

One thing to note is that the Trigger will execute as a "transaction". The error noted in your screen shot may be an indication that a WRITE operation is  happening in the Trigger program without a READU lock for the record being active. 



------------------------------
Neil Morris
Universe Advanced Technical Support
Rocket Software
------------------------------

One thing to note is that the Trigger will execute as a "transaction". The error noted in your screen shot may be an indication that a WRITE operation is  happening in the Trigger program without a READU lock for the record being active. 



------------------------------
Neil Morris
Universe Advanced Technical Support
Rocket Software
------------------------------

exactly this was happening :-)

I thought im my small Test-Basic subroutine I do a write to some log-file in the Account without caring for readu and so on.
After reading the log-record with readu before writing it works now. And I can continue.

Thanks a lot Neil - You helped a lot!

Lüdi



------------------------------
Thomas Ludwig
System Builder Developer
Rocket Forum Shared Account
------------------------------

exactly this was happening :-)

I thought im my small Test-Basic subroutine I do a write to some log-file in the Account without caring for readu and so on.
After reading the log-record with readu before writing it works now. And I can continue.

Thanks a lot Neil - You helped a lot!

Lüdi



------------------------------
Thomas Ludwig
System Builder Developer
Rocket Forum Shared Account
------------------------------

While injecting a little overhead, make the trigger program something small that calls the routine that does the actual work. Then, you can simply recompile and recatalog the work program to change the trigger behavior. Otherwise, you need to DROP TRIGGER, make changes and CATALOG, and CREATE TRIGGER.



------------------------------
Mark A Baldridge
Principal Consultant
Thought Mirror
Nacogdoches, Texas United States
------------------------------

While injecting a little overhead, make the trigger program something small that calls the routine that does the actual work. Then, you can simply recompile and recatalog the work program to change the trigger behavior. Otherwise, you need to DROP TRIGGER, make changes and CATALOG, and CREATE TRIGGER.



------------------------------
Mark A Baldridge
Principal Consultant
Thought Mirror
Nacogdoches, Texas United States
------------------------------

That's a very good point, thank you for this suggestion.

At the moment the Trigger is already finished and linked to the file, so i will wait until I have the first change to make  and change it the way you described.

Best regards

Lüdi



------------------------------
Thomas Ludwig
System Builder Developer
Rocket Forum Shared Account
------------------------------