'not()' and '!=' are not guaranteed to return the same result. To illustrate this with an example imagine if you wanted to get all objects from entity Person which are not associated to the current object of entity Team.
//Module.Person[Module.Person_Team!=$currentObject]
will give you only the persons that have a team associated and that team is different than currentObject.
//Module.Person[not(Module.Person_Team=$currentObject)]
will give you the persons who either do not have a team assigned or that team is different than currentObject.
A good way to think about XPath constraints is in terms of paths. The first XPath could be read as
"Give me all Persons where there is a path to a Team which is different than $currentObject"
If there is no path between a Person and Team this will return false.
while the second XPath says something completely different, namely:
"Give me all Persons where there is no path via the Person_Team association to $currentObject"
Hope this helps,
you tripped into a combination of XPath and Security + System.User Entity.
In general; Access rules on specializations rules over the generalization when dealing with an object of the specialization. Thus in your situation; Access rules on Administration.Account overrule the System.User access rules.
BUT, there is one exception which is the System.User entity. The access rule on this entity can NOT be overruled. Except through the Security settings => Userrole => manage users with at the most the following user roles (which you found)
Thus your Xpaths at Account level doesn't make any sense ;-)
This explains your question: Could you please explain why the 95 Account objects that are not associated with a user role at all are returned in all 3 situations
Hi Jeroen,
!= and not() are definitely not supposed to return the same results, they can but not by definition.
In this case the results are correct:
With the not statement you are saying you can see all accounts with none technical admin roles, even if they have others. With the != satement you are saying you can see all accounts whom have a role not equal to the technical admin role. Since there is 1 account with a technical admin role but also other roles that one is also returned.
Hopefully this clarifies things.
The following answer was provided on a similar forum question: https://forum.mendix.com/link/questions/2164
"The difference between them is that "!=" compares two values and if they are the same it returns false, if not it returns true. "not()" checks whether certain logic holds true and if so it returns false, if not it returns true. In other words "not()" is a logical operator while "!=" is a comparison operator.
To quote some random page on the internet:
Comparison operators are used in logical statements to determine equality or difference between variables or values.
Logical operators are used to determine the logic between variables or values.
Say x = false and y = false:
not(x and y) returns true;
while x != y returns false;
EDIT (added): Compare: "not(x=100)" to "x!=100" and it should be obvious why using != is superior for comparing two values."