# How to set tag quality with TagManager?

**URL:** <https://forum.inductiveautomation.com/t/how-to-set-tag-quality-with-tagmanager/11267>\
**Category:** Module Development\
**Created:** [February 24, 2016, 10:54pm UTC](https://forum.inductiveautomation.com/t/how-to-set-tag-quality-with-tagmanager/11267 "2016-02-24T22:54:23Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![austral](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/austral/32/23644_2.png) [@austral](https://forum.inductiveautomation.com/u/austral)\
**Post date:** [February 24, 2016, 10:54pm UTC](https://forum.inductiveautomation.com/t/how-to-set-tag-quality-with-tagmanager/11267/1 "2016-02-24T22:54:23Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [February 24, 2016, 10:59pm UTC](https://forum.inductiveautomation.com/t/how-to-set-tag-quality-with-tagmanager/11267/2 "2016-02-24T22:59:10Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![austral](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/austral/32/23644_2.png) [@austral](https://forum.inductiveautomation.com/u/austral)\
**Post date:** [March 31, 2016, 4:39pm UTC](https://forum.inductiveautomation.com/t/how-to-set-tag-quality-with-tagmanager/11267/3 "2016-03-31T16:39:53Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![dpitzer](https://avatars.discourse-cdn.com/v4/letter/d/b5a626/32.png) [@dpitzer](https://forum.inductiveautomation.com/u/dpitzer)\
**Post date:** [August 2, 2016, 5:49am UTC](https://forum.inductiveautomation.com/t/how-to-set-tag-quality-with-tagmanager/11267/4 "2016-08-02T05:49:06Z")

</div>

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.
