Sybase NNTP forums - End Of Life (EOL)

The NNTP forums from Sybase - forums.sybase.com - are now closed.

All new questions should be directed to the appropriate forum at the SAP Community Network (SCN).

Individual products have links to the respective forums on SCN, or you can go to SCN and search for your product in the search box (upper right corner) to find your specific developer center.

Functions available in a Trigger?

4 posts in Trigger Last posting was on 2009-03-01 21:26:59.0Z
Ian Branch Posted on 2009-02-24 00:36:31.0Z
From: "Ian Branch" <branch@celestial.com.au>
Subject: Functions available in a Trigger?
Newsgroups: Advantage.Trigger
Date: Tue, 24 Feb 2009 11:36:31 +1100
User-Agent: XanaNews/1.19.1.160
Message-ID: <xn0g6skgf8cb4y000@devzone.advantagedatabase.com>
X-Ref: DevZone.AdvantageDatabase.com ~XNS:000000F7
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
NNTP-Posting-Host: 58.171.164.127
X-Trace: 23 Feb 2009 17:36:07 -0700, 58.171.164.127
Lines: 29
Path: solutions.advantagedatabase.com!solutions.advantagedatabase.com!58.171.164.127
Xref: solutions.advantagedatabase.com Advantage.Trigger:421
Article PK: 1136483

Hi Guys,

Having set an applicationID of 'ST:ABC123:FALSE' and retrieved the ID using
ApplicationID(), how do I achieve the following in a Trigger..



<<pseudo code starts>>
sID = ApplicationID();

sAction = StrTokenExtract(sID, 1); Should give me ST
sUserID = StrTokenExtract(sID, 2); Should give me ABC123
sFlag = StrTokenExtract(sID, 3); Should give me FALSE

If sAction = 'ST' then
try
<<pseudocode ends>>

So I can do this..

<<pseudo code starts>>
insert into Partslog ( Partnum, Action, Qty, WtyRepair, User_ID,
DateTimeLogged) values (New.PartNum, 'ST', New.WtyQty - Old.WtyQty, sFlag,
sUserID, Now());
<<pseudo code ends>>

Regards & TIA,

Ian


Edgar Sherman Posted on 2009-02-24 15:03:48.0Z
Date: Tue, 24 Feb 2009 08:03:48 -0700
From: Edgar Sherman <no@email.com>
User-Agent: Thunderbird 2.0.0.19 (Windows/20081209)
MIME-Version: 1.0
Newsgroups: Advantage.Trigger
Subject: Re: Functions available in a Trigger?
References: <xn0g6skgf8cb4y000@devzone.advantagedatabase.com>
In-Reply-To: <xn0g6skgf8cb4y000@devzone.advantagedatabase.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 10.24.34.164
Message-ID: <49a40c2c@solutions.advantagedatabase.com>
X-Trace: 24 Feb 2009 08:03:08 -0700, 10.24.34.164
Lines: 56
Path: solutions.advantagedatabase.com!solutions.advantagedatabase.com!10.24.34.164
Xref: solutions.advantagedatabase.com Advantage.Trigger:422
Article PK: 1136481

Ian,

You should be able to do something similar to the following

declare sID string;
declare sAction string;
declare sFlag string;

set sID = (select ApplicationID() from system.iota);

set sAction = (select StrTokenExtract(sID, 1) from system.iota);
--Should give me ST
set sUserID = (select StrTokenExtract(sID, 2) from system.iota);
--Should give me ABC123
set sFlag = (select StrTokenExtract(sID, 3) from system.iota); --Should
give me FALSE

If sAction = 'ST' then
try
<<pseudocode ends>>



I didn't get a chance to try it out, but this should be what you want.
Edgar

Ian Branch wrote:
> Hi Guys,
>
> Having set an applicationID of 'ST:ABC123:FALSE' and retrieved the ID using
> ApplicationID(), how do I achieve the following in a Trigger..
>
>
>
> <<pseudo code starts>>
> sID = ApplicationID();
>
> sAction = StrTokenExtract(sID, 1); Should give me ST
> sUserID = StrTokenExtract(sID, 2); Should give me ABC123
> sFlag = StrTokenExtract(sID, 3); Should give me FALSE
>
> If sAction = 'ST' then
> try
> <<pseudocode ends>>
>
> So I can do this..
>
> <<pseudo code starts>>
> insert into Partslog ( Partnum, Action, Qty, WtyRepair, User_ID,
> DateTimeLogged) values (New.PartNum, 'ST', New.WtyQty - Old.WtyQty, sFlag,
> sUserID, Now());
> <<pseudo code ends>>
>
> Regards & TIA,
>
> Ian


Thomas Steinmaurer Posted on 2009-03-01 14:02:09.0Z
Date: Sun, 01 Mar 2009 15:02:09 +0100
From: Thomas Steinmaurer <t.steinmaurer_dontbugmewithspam_@upscene.com>
User-Agent: Thunderbird 2.0.0.19 (Windows/20081209)
MIME-Version: 1.0
Newsgroups: Advantage.Trigger
Subject: Re: Functions available in a Trigger?
References: <xn0g6skgf8cb4y000@devzone.advantagedatabase.com>
In-Reply-To: <xn0g6skgf8cb4y000@devzone.advantagedatabase.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 212.241.89.51
Message-ID: <49aa9521@solutions.advantagedatabase.com>
X-Trace: 1 Mar 2009 07:01:05 -0700, 212.241.89.51
Lines: 54
Path: solutions.advantagedatabase.com!solutions.advantagedatabase.com!212.241.89.51
Xref: solutions.advantagedatabase.com Advantage.Trigger:423
Article PK: 1136484

Hello Ian,

> Having set an applicationID of 'ST:ABC123:FALSE' and retrieved the ID using
> ApplicationID(), how do I achieve the following in a Trigger..
>
>
>
> <<pseudo code starts>>
> sID = ApplicationID();
>
> sAction = StrTokenExtract(sID, 1); Should give me ST
> sUserID = StrTokenExtract(sID, 2); Should give me ABC123
> sFlag = StrTokenExtract(sID, 3); Should give me FALSE
>
> If sAction = 'ST' then
> try
> <<pseudocode ends>>
>
> So I can do this..
>
> <<pseudo code starts>>
> insert into Partslog ( Partnum, Action, Qty, WtyRepair, User_ID,
> DateTimeLogged) values (New.PartNum, 'ST', New.WtyQty - Old.WtyQty, sFlag,
> sUserID, Now());
> <<pseudo code ends>>

Just a note.

We have implemented this feature:
http://tracker.upscene.com/view.php?id=1169

in the current ADS LogManager 2.3 RC2 build. This allows you to define
what should go into the USER_NAME and APP_NAME column of the operation
log table. This can be set for each project in the connect to database
dialog, tab Logging Options | Additional Settings. You could use your
function StrTokenExtract there and ADSLM will use that when generating
the log trigger.

Just in case you are interested:
http://www.adslogmanager.com/download/adslm80/ADSLogManager2_2306_RC2.zip

Hope this helps.


--
Best Regards,
Thomas Steinmaurer
LogManager Series - Logging/Auditing Suites supporting
InterBase, Firebird, Advantage Database, MS SQL Server and
NexusDB V2
Upscene Productions
http://www.upscene.com
My blog:
http://blog.upscene.com/thomas/


Ian Branch Posted on 2009-03-01 21:26:59.0Z
From: "Ian Branch" <branch@celestial.com.au>
Subject: Re: Functions available in a Trigger?
Newsgroups: Advantage.Trigger
References: <xn0g6skgf8cb4y000@devzone.advantagedatabase.com> <49aa9521@solutions.advantagedatabase.com>
Date: Mon, 2 Mar 2009 08:26:59 +1100
User-Agent: XanaNews/1.19.1.160
Message-ID: <xn0g76h5ppf4v000@devzone.advantagedatabase.com>
X-Ref: DevZone.AdvantageDatabase.com ~XNS:000000F8
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
NNTP-Posting-Host: 218.215.180.115
X-Trace: 1 Mar 2009 14:26:33 -0700, 218.215.180.115
Lines: 10
Path: solutions.advantagedatabase.com!solutions.advantagedatabase.com!218.215.180.115
Xref: solutions.advantagedatabase.com Advantage.Trigger:424
Article PK: 1136487

Hi Thomas,

Thank you for the consideration and implementation, I will have a play.

The StrTokenExtract functions are "pseudocode" borrowing from my Clipper days.
I haven't actually implemented such a function as yet.

Regards,

Ian