# StoreAndForward exception

**URL:** <https://forum.inductiveautomation.com/t/storeandforward-exception/6210>\
**Category:** Module Development\
**Created:** [April 11, 2013, 7:13pm UTC](https://forum.inductiveautomation.com/t/storeandforward-exception/6210 "2013-04-11T19:13:28Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![idelamer](https://avatars.discourse-cdn.com/v4/letter/i/e5b9ba/32.png) [@idelamer](https://forum.inductiveautomation.com/u/idelamer)\
**Post date:** [April 11, 2013, 7:13pm UTC](https://forum.inductiveautomation.com/t/storeandforward-exception/6210/1 "2013-04-11T19:13:28Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Colby.Clegg](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/colby.clegg/32/3282_2.png) [@Colby.Clegg](https://forum.inductiveautomation.com/u/Colby.Clegg)\
**Post date:** [April 15, 2013, 3:18pm UTC](https://forum.inductiveautomation.com/t/storeandforward-exception/6210/2 "2013-04-15T15:18:19Z")

</div>

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,
