I’m trying to manually store tag history using the following lines:
[code]HistoricalTagValue histValue = new PackedHistoricalTagValue(this.getTagPath(), this.getDataTypeClass(), InterpolationMode.Discrete, TimestampSource.Value, new BasicTagValue(value, DataQuality.GOOD_DATA, timeStamp));
context.getHistoryManager().storeHistory(getAttribute(TagProp.PrimaryHistoryProvider).getValue().toString(), histValue);[/code]
However this generates an class cast exception in StoreAndForward and the values are quarantined.
[code]
MemoryForwardTransaction Error forwarding data: com.inductiveautomation.ignition.gateway.history.PackedHistoricalTagValue cannot be cast to com.inductiveautomation.ignition.gateway.history.ScanclassHistorySet
java.lang.ClassCastException: com.inductiveautomation.ignition.gateway.history.PackedHistoricalTagValue cannot be cast to com.inductiveautomation.ignition.gateway.history.ScanclassHistorySet
at com.inductiveautomation.ignition.gateway.sqltags.history.storage.TagHistoryDatasourceSink.storeDataToDatasource(TagHistoryDatasourceSink.java:308)
at com.inductiveautomation.ignition.gateway.history.sinks.AbstractDatasourceSink.storeToDatasource(AbstractDatasourceSink.java:123)
at com.inductiveautomation.ignition.gateway.history.sinks.AbstractDatasourceSink.storeData(AbstractDatasourceSink.java:99)
at com.inductiveautomation.ignition.gateway.history.sinks.AggregateSink.storeData(AggregateSink.java:147)
at com.inductiveautomation.ignition.gateway.history.forwarders.ForwarderThread.run(ForwarderThread.java:138)[/code]
Do I need to be using BasicScanclassHistorySet to store data? Anything I’m missing here?
Cheers
Ivan