Quote:
Originally Posted by davidfor
This is an example I have for a trigger on the Activity table. This should keep the stats tile as the first one. As long as it gets updated by the system at least once a month, it will stay.
Code:
CREATE TRIGGER Activity_KeepTileFirst_UPDATE
AFTER UPDATE ON Activity
FOR EACH ROW
WHEN ( new.Type = 'GlobalStats')
BEGIN
UPDATE Activity
SET Date = datetime(Date,'+1 month')
WHERE rowid = new.rowid;
END
It has been a while since I tried this. It should work, but I have vague memory that there is a problem with it.
|
Thanks a lot for this. If I wanted to keep the browser tile as the first one, how would I do it?
I have tried this, but it doesn't work:
Code:
CREATE TRIGGER Activity_KeepTileFirst_UPDATE
AFTER UPDATE ON Activity
FOR EACH ROW
WHEN ( new.Type = 'browser')
BEGIN
UPDATE Activity
SET Date = datetime(Date,'+1 month')
WHERE rowid = new.rowid;
END