Bug x-path constraint in 2.5.3?

1
Situation: A employee has 1 contract. 1 contract has serveral formaties 1 formaties has 1 afdeling. Each formatie has a begin and end-date 1 afdeling has 1 or more manager I want to show the actual employees (formatie enddat is empty or > today) of an manager. But when i use the xpath constraints ALWAYS all the employees with a old formatie (enddate < today) is shown. For example: Marco Naarden has 3 formaties 1-1-2011 till 1-3-2011 afdeling X (manager 1) 1-3-2011 till 1-5-2011 afdeling Y (manager 2) 1-3-2011 till ... afdeling Z (manager 3) With the xpathconstraints below, manager 2 sees Marco Naarden.... Why and how the solve this? Xpath i have tried: 1: [Basis.ContractMedewerker/Basis.Contract [Basis.FormatieContract/Basis.Formatie/Basis.FormatieAfdeling/Basis.Afdeling [Basis.Managers = '[%CurrentUser%]' ] ] ] [Basis.ContractMedewerker/Basis.Contract/Basis.Formatie_Contract/Basis.Formatie/Einddatum > '[%BeginOfCurrentDay%]' ] [Basis.ContractMedewerker/Basis.Contract/Basis.FormatieContract/Basis.Formatie/Basis.FormatieAfdeling/Basis.Afdeling/Basis.Managers = '[%CurrentUser%]' and Basis.ContractMedewerker/Basis.Contract/Basis.Formatie_Contract/Basis.Formatie/Einddatum > '[%BeginOfCurrentDay%]'] 3. [Basis.ContractMedewerker/Basis.Contract/Basis.FormatieContract/Basis.Formatie/Basis.FormatieAfdeling/Basis.Afdeling/Basis.Managers = '[%CurrentUser%]'] [Basis.ContractMedewerker/Basis.Contract/Basis.Formatie_Contract/Basis.Formatie/Einddatum > '[%BeginOfCurrentDay%]']
asked
1 answers
6

Try this one:

[
   Basis.ContractMedewerker/Basis.Contract/Basis.FormatieContract/Basis.Formatie
   [
      Basis.FormatieAfdeling/Basis.Afdeling/Basis.Managers = '[%CurrentUser%]'
      and Einddatum > '[%BeginOfCurrentDay%]'
   ]
]

The problem with your queries is that you're checking for employees that meet the following criteria:

  • has a 'formatie' with a certain 'afdeling'
  • has a 'formatie' -- any 'formatie', not just the one passing the first criterion! -- with a certain 'einddatum'

I've formatted your second query to show the difference compared to my query:

[
   Basis.ContractMedewerker/Basis.Contract/Basis.FormatieContract/Basis.Formatie/Basis.FormatieAfdeling/Basis.Afdeling/Basis.Managers = '[%CurrentUser%]'
   and
   Basis.ContractMedewerker/Basis.Contract/Basis.FormatieContract/Basis.Formatie/Einddatum > '[%BeginOfCurrentDay%]'
]

You'll notice the entire path from 'medewerker' to 'formatie' being repeated: this is why any employee that has any combination of 'formaties' that together meet both criteria is turning up in your result. In my query the path only appears once, which tells Mendix you're looking for any 'medewerker' that has a (single) 'formatie' that meets both criteria by itself.

answered