XPath constraint: what wrong in [$Grade_Entity.dishname = $Menu.dishname]

In the dateview source, I choose XPath, and in XPath, I want to compare two entities' attributes, and When two entities' attributes are same , then show other attributes of one entity    I write the sentence like that:   [$Grade_Entity.dishname = $Menu.dishname] but the mendix tells me it's wrong. WHY?  
2 answers

You are comparing two variables, but you can only compare variables with xPath elements.
Something like:  [dishname = $Menu/dishname]


In a dataview you do not have the source Xpath. So i guess you are constructing a Dataview in which you have two containers. The first container should have the visibility constraint that two entities attributes are the same, the second container should have the constraint that they are different.

[$Grade_Entity.dishname = $Menu.dishname]

When looking at your Xpath, I assume you want to compare a the attributes of the Entity called "Entity" (you should change the association name and possibly the entity to a normal name), with an attribute of the Menu entity. All this is done in the dataview of the Grade entity.


Your Xpaths should look something like this:

[$Grade_Entity/Entity/dishname = $Grade_Menu/Menu/dishname]


Best is to provide us with a picture of your Datamodel