austral
February 24, 2016, 10:54pm
1
Hi,
I wrote this code to set a value to a specific tag and it works.
[color=#0000BF]writes.add(new BasicWriteRequest<>(TagPathParser.parse(se.tagPath),se.value));
context.getTagManager().write(writes, null, true);
[/color]
unfortunately, I can’t find how to set the quality of the tag.
Can you help me?
BR
You can supply a QualifiedValue to the write request.
A convenient subclass, BasicQualifiedValue, should make this fairly easy. You can use your own Quality implementation or one from the DataQuality enum.
Thanks for you answer but I did that and that seems not well:
[color=#0000FF]writes.add(new BasicWriteRequest<>(tagPath, se.getBasicQualifiedValue()));
context.getTagManager().write(writes, null, true)[/color]
where se is an SimulEvent like :
[color=#0000FF]public class SimulEvent {
public String tagPath;
public String ts;
public EventType type;
public double value;
private DataQuality quality;
public BasicQualifiedValue getBasicQualifiedValue(){
BasicQualifiedValue bqv = new BasicQualifiedValue();
bqv.setValue(this.value);
bqv.setQuality((Quality)this.quality);
return bqv;
}
}[/color]
Have you got a complete exemple for me?
best regards
The DataQuality type has enumerations to represent different quality values. ie. DataQuality.GOOD_DATA or DataQuality.ACCESS_DENIED.
Check out the javadocs for com.inductiveautomation.ignition.common.sqltags.model.types.DataQuality to get all of them.
When you set the quality of your qualified tag, you need to set it to a specific quality enumeration.
bqv.setQuality(DataQuality.GOOD_DATA);
See if that gets you any closer.