View Single Post
Old 03-19-2018, 05:15 PM   #1475
ItalianUruguayan
Connoisseur
ItalianUruguayan makes transoceanic flights without the assistance of an airplaneItalianUruguayan makes transoceanic flights without the assistance of an airplaneItalianUruguayan makes transoceanic flights without the assistance of an airplaneItalianUruguayan makes transoceanic flights without the assistance of an airplaneItalianUruguayan makes transoceanic flights without the assistance of an airplaneItalianUruguayan makes transoceanic flights without the assistance of an airplaneItalianUruguayan makes transoceanic flights without the assistance of an airplaneItalianUruguayan makes transoceanic flights without the assistance of an airplaneItalianUruguayan makes transoceanic flights without the assistance of an airplaneItalianUruguayan makes transoceanic flights without the assistance of an airplaneItalianUruguayan makes transoceanic flights without the assistance of an airplane
 
ItalianUruguayan's Avatar
 
Posts: 52
Karma: 55058
Join Date: Mar 2018
Location: Spain
Device: Kobo Glo HD
Quote:
Originally Posted by davidfor View Post
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
ItalianUruguayan is offline