The HasTag(tagname) query method ONLY evaluates to true if the tag has a value, not if it just exists. Which I submit is contrary to the documentation:
"Evaluates to true if the associated element has a tag with the name tagname."
To be a pedant it doesn't exist if it is null, the only thing that exists is a descriptor. Null has been described as the worst mistake in computer science, and the arguments for that position all seem to be true.
Perversely, HasTag(tagname,””) will fire if the tag has an empty (null) value or EVEN if the tag does not exist, which again, I submit is contrary to the documentation:
"If the second parameter tagvalue is provided, the tag tagname must be present, and the value of the tag has to be equal to tagvalue for the method to evaluate to true."
Obviously does null equal null will evaluate as true. See previous point about null.
Let's hear it for Pedantry!
I absolutely agree on NULL.
However, given the definition of NULL (that is, NOT being a value), one can't use equality with null, one can only use IsNull().
Further, it IS the case that a Tagged Value consists of two parts: The Value (the primary concept) and the Tag (Descriptor/Identifier). The problem is that the Tag can exist in EA
without a Value. This would appear to be a conceptual defect.
One should not be allowed to create a tagged value without supplying and maintaining a value. Then the documentation can specify:
HasTag(tagname) will evaluate to true if the Tagged Value tagname exists (regardless of the assigned value).
HasTag(tagname, tagvalue) will evaluate to true if the value of the tagname is tagvalue.
Now it works.
If EA insists on allowing tags with empty/null values, then the documentation needs to be adjusted and the code updated since the tag can exist without the value (and so, I guess, isn't a tagged value

)
Paolo