Checking value of an enumeration attribute with true or false in XPath

0
An entity DH_ArticleFilter has 2 attributes: - enumeration attribute Deleted, which can have the enumeration values 'Deleted' or 'NotDeleted'. - enumeration attribute Active, which can have the enumeration values 'Active' or 'NotActive'.   In an application that I am working on, I encountered something strange. An enumeration attribute is being checked with true or false and no build errors occur, see screenshot below. Can somebody explain to me what is going on here and why this is working inside an XPath constraint? And what does it mean if you check if the value of an enumeration attribute is equal to true or false?   Update: I was wondering if anybody knows why the syntax of XPath allows a comparison between a boolean and another type such as enumeration? Do the keywords true and false represent something special in XPath? And is this  due to backwards compatibility with how it worked in an earlier version of Mendix?      
asked
1 answers
1

What MxStudio version? Version 10, I presume. I tried this in a retrieve-activity and found this behavior:
The $currentObject/<anyAttributeOtherThanBoolean> = true seems to always return false

The $currentObject/<anyAttribute> = false seems to always return false

 

The $currentObject/<anyAttributeOfTypeBoolean> = true returns true if the boolean is true

The $currentObject/<anyAttributeOfTypeBoolean> = true() returns true if the boolean is true

 

The XPath editor seems to accept only as value 'true'. It only accepts 'true()' if the attribute is of type boolean.

 

So, apparently the editor has an oversight in the validation of the xpath-expression and it is ok with comparing any attribute against a boolean-value. This is probably a choice that Mendix made for backward compatibility. 

 

For your code I expect this to result in: only the objects where both enumerations are empty. This because each Delete=true, Delete=false, Active=true, Active=false are false.

answered