The reason for the id (or id's) not being stored with the alarm history is the chance of the note being deleted after the alarm has been acknowledged. You can, however, add some trigger work to the database that will store the information you are after in a separate table. So the next step is to update the database.db file with the following (or run the enclosed script in the NAS). When this is done, all new attach requests will be stored both in NAS_ALARM_NOTE and PRIV_NOTE_HISTORY.
1. Create a table to hold the historic (NAS_ALARM_NOTE) information, lets call it PRIV_NOTE_HISTORY
CREATE TABLE PRIV_NOTE_HISTORY ('nimid' text NOT NULL , 'note_id' int NOT NULL , 'time' datetime NOT NULL )
2. Create a trigger to act on 'attach note', lets call it PRIV_
CREATE TRIGGER PRIV_TRG_NOTE_ATTACH AFTER INSERT ON NAS_ALARM_NOTE
BEGIN
INSERT INTO PRIV_NOTE_HISTORY ( nimid, note_id, time) VALUES (new.nimid, new.note_id,new.time);
END
--
-- Create table and trigger to store alarm notes historically
--
database.open ("database.db")
database.query("CREATE TABLE PRIV_NOTE_HISTORY ('nimid' text NOT NULL , 'note_id' int NOT NULL , 'time' datetime NOT NULL )")
database.query("CREATE TRIGGER PRIV_TRG_NOTE_ATTACH AFTER INSERT ON NAS_ALARM_NOTE BEGIN INSERT INTO PRIV_NOTE_HISTORY ( nimid, note_id, time) VALUES (new.nimid, new.note_id,new.time);END")
database.close()
Hope this helps,
Carstein