StoreAndForward exception

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

Hi,

Yes, apparently you do need to use the ScanclassHistorySet. It shouldn’t necessarily be like that, but that’s how it goes for now. Just use [tt]BasicScanclassHistorySet[/tt], create it with any name you want and a rate of 0 (the 0 rate will tell the system not to actually store execution statistics for it), and add your values to it.

Regards,