Checking value of an enumeration attribute with true or false in XPath (fixed in Studio Pro 10.24.10 and 11.4.0)

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
2 answers
2

This issue turns out to be a bug and unfortunately, it remains to work like this in the versions of Studio Pro 9.24.

 

However, this issue has been fixed in version 10.24.10 and 11.4.0 of Studio Pro, which was released on 30 October 2025 and 5 November 2025, respectively. The release notes mention this bug as follows:

 

  • We fixed an issue in the Studio Pro XPath constraint parser with the treatment of true and false. These are now treated the same as their function equivalents (true() and false() respectively).

 

What does this mean for example?

If you open the project in Studio Pro version 10.24.10 or 11.4.0 (or later) and start editing the XPath as given in description above, it is no longer allowed to check an enumeration attribute with the boolean values true and false. Then the following consistency error is shown:

 

Consistency error of incompatible types

answered
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