I am trying to get a list of physicians to monitor their credentials. This is the formula that I am using for the record selection:
IsNull({STAFF_TERMINATION_HISTORY.TERMINATION_DATE})
And
{STAFF_ENROLLMENT_HISTORY.PRACTITIONER_CATEGORY_VALUE} In ["PHYSICIAN", "PSYCHIATRIST"]
And
{STAFF_ENROLLMENT_HISTORY.STAFFID} <> "000004"
OR
{SITE_SPECIFIC_STAFF_ENROLLMENT.REGISTRATION_DATE} > {STAFF_TERMINATION_HISTORY.TERMINATION_DATE}
And
{STAFF_ENROLLMENT_HISTORY.PRACTITIONER_CATEGORY_VALUE} In ["PHYSICIAN", "PSYCHIATRIST"]
And
{STAFF_ENROLLMENT_HISTORY.STAFFID} <> "000004"
The problem that I am having is that the formula directly after the "or" is causing people to show up that are no longer employed. Our system tracks the termination date and the registration date and sometimes people have four or five stints of employment. I am only wanting if the registration date is after the latest termination, but this formula pulls for all terminations. How can I recode the formula to get the desired results.