Datacollector insert fails to fire (a good) trigger

Discussions related to custom development with Select.
Post Reply
rburns
Posts: 2
Joined: Wed Jan 06, 2010 4:38 pm

Datacollector insert fails to fire (a good) trigger

Post by rburns »

Hello

First, please forgive any misplacement of this post. 1st time member.

Here we go:

Softpro version: std12, upgrade problem from std10.0.2
Backend: SqlServer

I have a trigger on UserTable06. (Listing below)
Trigger Summary:
The first time a record is added with a value for TX06CPDT and a firmfile number, add a record to another table (Trig01) with that value, the firmfile number, and the current timestamp.

In laymen's terms: Record forever the exact time/date the first time a proform user sets a value for TX06CPDT so I can query it using sql.
  • - The trigger works when inserts are done manually,
    - It DID work when the inserts were done by the data collector when we had std10.0.2. but not any more for the data collector inserts, failure beginning exactly when we upgraded to 12.
    - I've tested the trigger by manually adding a row to UserTable06 after the upgrade to 12. It still works. Just not when the data collector does the insert.
    - I can see records being inserted into UserTable06 by the data collector when TX06CPDT is set in proform, and proform is closed, but the trigger does not fire.
Justin (softpro tech support) tells me that there are no known issues that might cause this between std10.0.2 and std12. He also told me that data collector does not use stored procedures. (I suspected stored procedures with the parameter set to prevent triggers).

Please let me know it you have any thoughts on this.

THANK YOU in advance.

__________________________
Here's the trigger:
__________________________

CREATE TRIGGER updUserTable06
ON UserTable06
FOR update AS

IF UPDATE(TX06CPDT) -- i.e.if an update was done to this row
BEGIN

-- Checks if record already exists or not, to allow it to update or insert
IF NOT EXISTS (Select t.source
From Trig01 t
Join inserted ins
On t.Source = 'TX06CPDT'
And t.FirmFile = ins.FirmFile
Where t.Source = 'TX06CPDT'
And t.FirmFile = ins.FirmFile)

BEGIN -- Insert Record
-- Record does not exist, so lets insert a new one.
INSERT INTO Trig01 (Source, FirmFile, TX06CPDT)
SELECT 'TX06CPDT' Source, ins.FirmFile, getdate()
FROM inserted ins
END
END
__________________________
Phil Barton
Posts: 54
Joined: Wed Sep 24, 2008 2:37 pm
Location: Raleigh, NC
Contact:

Re: Datacollector insert fails to fire (a good) trigger

Post by Phil Barton »

Due to changes made to support the new HUD GFE, ProForm and DataCollector no longer update an existing row. Rather, they delete the existing row and insert a new row. This may be the cause of the trigger not firing.
Phil Barton
Software Architect
SoftPro
rburns
Posts: 2
Joined: Wed Jan 06, 2010 4:38 pm

Re: Datacollector insert fails to fire (a good) trigger

Post by rburns »

Outstanding. Spot on.

THANK YOU!
Post Reply