Problem in XPath

0
Hi all Mendix Gurus. I am showing form with a data grid of Staff. In the XPath I have: [Staff.Staff_Company/Customers.Company/Customers.RegisteredUser_Company/Customers.RegisteredUser/id = '[%CurrentUser%]'] (RegisteredUser is type of System.User) Domain model looks like Company(1) <- Staff() and Company(1) <- RegisteredUser() In the database I have ten staff and I can see that half is related to one company and half to second company. You can see in xpath that I want to show only staff which are related to company to which my login account is related. Problem is that I can see all ten staff. This XPath consruction I am using in different places and it works perfectly, but not in this case? I think it can be some kind of bug. Do anybody have some experiences with thiss issue?
asked
2 answers
1

Hi all. Thanks for all advices. The problem was really that my grid was called from ref set selector. I have used XPath constraint in Selectable objects property and it is working now.

Have a nice day.

Lukas

answered
0

It's difficult to be certain without seeing your domain model, but it looks to me like your X-path may have gone down too many levels.

Try

[Staff.Staff_Company/Customers.Company/Customers.RegisteredUser_Company = '[%CurrentUser%]'] 

This one is checking that (reading from right to left) the current user is a registered user linked to a company, and the company is linked to the Staff to be displayed, which should be all that you need.

answered