How to do Where object not in list with XPath - I want to get unused results in a dropdown

Hi,   I am trying to do something that I think must be really simple, but I can't figure out a way to do it with XPath.   I am doing the introduction training, and in the Registration page I only want to list the trainees in the drop down (reference selector) that have not been registered yet in a specific scheduled course. So, if I have 5 trainees and I register one in "Course 1", then the next time I register a trainee for "Course 1", I only want to have 4 trainees in my drop down. With SQL I would just get all trainees "WHERE Trainee NOT IN TraineesInMyRegistrationListForThisScheduledCourse". How do I do this with XPath - it is possible, right?   I was assuming it would be something like "//Trainee.Name[not(RegistrationList/Trainee/Name)]"   Thanks Goncalo
2 answers


In Xpath, you can test if an association is populated like this:  ModuleName.AssociationName/AssociationObject

So to see if an association is empty, the syntax is:  not(ModuleName.AssociationName/AssociationObject)

An actual example from one of my apps:  not(Schedule.Appointments_Contact/Schedule.Appointment)

This example retrieves customer contact records for which an appointment has not been created.

Hope that helps,



Hi Mike,


Many thanks for your suggestion. It works, but not the way I need it to. I should have explained my situation better.



  • I have a list of scheduled courses
    • For each scheduled course I can add a registration
      • Per registration I need to associate a trainee (from a list of trainees)
      • If I have 2 registrations, this means I have 2 trainees attending this specific course
        • If I create a new registration (number 3), then I want to see my list of trainees (except the 2 I already added)
    • If I create a new scheduled course
      • And create a new registration for this new course, I want to see a list of all my trainees (as per my original post, I would see 5 trainees)
        • With the solution you gave me, my list of trainees would only return 3 (it would consider that 2 had already been registered in the other course) - which is not what I want



Hope this makes sense