See the xpath in a Retreive: ... and ( ($MendixCID = empty or ($MendixCID != empty and Registration.Registration_Provider_Implant/Registration.Provider/UID = $MendixCID)) or ($MendixCID = empty or ($MendixCID != empty and Registration.Registration_Provider_Following/Registration.Provider/UID = $MendixCID)) ) ] ======== Defect in Mendix version 6.8.1 ===== My table has 2 records. Refer to the "or" in above xpath. If I remove any one of the 2 condition that are separated by "or" then both record satisfy the xpath and both are fetched. But when I retain it as above i.e. 2 conditions separated by "or", then only 1 recorded is fetched. How in the world can a "or" fetch less records??? $MendixCID is empty. I know of ways to change the above xpath and make it work. But my question is why the above simple looking xpath generates wrong SQL.
This seems to be a known bug. I think you need to upgrade your model.
You can simplify this to,
($MendixCID = empty or
(Registration.Registration_Provider_Implant/Registration.Provider/UID = $MendixCID or
Registration.Registration_Provider_Following/Registration.Provider/UID = $MendixCID)