I am confused with the documentation on how to perform a History Set per Row.
Can you provide me the different steps required to do a history set correctly?
1. Which of my column params require the history set attribute? Only the items I want to apply history set on?
2. How to apply it on protocol.AddRow.
3. How to apply it on protocol.SetRow.
Having a practical example would help a lot.
In the end I want my alarmed columns to generate an alarm based on the passed time instead of the time of setting the row.
Hi Mieke,
Here are some answers to your questions:
1. Only the parameters you want to utilize historyset on needs to be marked as such. So if only 2 columns need to utilize functionality provided by historyset, you apply it only on those 2.
2. to use it with protocol.addrow, you wrap the row in an object[] where index 0 is the objectarray representing the row, and index 1 is the DateTime to use for the set.
Example:
DateTime TimeOfSet = DateTime.Now.AddDays(-1);
var row = new ExampleQActionRow { /*values*/};
Protocol.AddRow(Parameter.Example.tablePid, new object[] { row.ToObjectArray(), TimeOfSet });
3. To use it with a Protocol.SetRow there is an override for this in the protocol object which takes in a timestamp.
Example:
DateTime TimeOfSet = DateTime.Now.AddDays(-1);
var row = new ExampleQActionRow { /*Values*/};
Protocol.SetRow(Parameter.Example.tablePid, row.Key, row.ToObjectArray(), TimeOfSet);
Hope this helps a bit to clarify things.