I was using :
com.inductiveautomation.ignition.gateway.history.PackedHistoricalTagValue
to store history in Ignition 7.9.
This function seems to be still available in Ignition 8 but it use legacy TagPath / DataQuality
is there another class to replace PackedHistoricalTagValue ? or how to use it in Ignition 8 ?
it seems that the mix of legacy and new class is possible…
import com.inductiveautomation.ignition.common.tags.model.TagPath;
...
CompletableFuture<List<QualifiedValue>> future = this.gatewayContext.getTagManager().readAsync(tagPaths);
List<QualifiedValue> qualifiedValues = future.get();
if (qualifiedValues.size() == tagPaths.size()){
for (QualifiedValue qualifiedValue : qualifiedValues) {
if (qualifiedValue != null) {
com.inductiveautomation.ignition.common.sqltags.model.TagPath tagPath = com.inductiveautomation.ignition.common.sqltags.parser.TagPathParser.parseSafe("default", tagPaths.get(i).toStringFull());
historicalTagValue = new PackedHistoricalTagValue(tagPath,
tagDataTypes.get(i).getTypeClass(),
tagDataTypes.get(i).getTypeClass() == DataTypeClass.Float ? InterpolationMode.Analog_Compressed : InterpolationMode.Discrete,
TimestampSource.Value,
qualifiedValue.getValue(),
DataQuality.getQualityFor(qualifiedValue.getQuality().getCode()),
qualifiedValue.getTimestamp());
}
}
i = i + 1;
}
1 Like
How do you use queryHistory to query historical data, I have encountered some difficulties, the query timed out