diff --git a/entity/Person_entity/recordcontainers/db/recordfieldmappings/organisations/filterConditionProcess.js b/entity/Person_entity/recordcontainers/db/recordfieldmappings/organisations/filterConditionProcess.js index c1b50e3da94468e2382abbc28ab9b56a464dbe97..b2c8e025af01c5e7d8923b37a66bd59c183772c4 100644 --- a/entity/Person_entity/recordcontainers/db/recordfieldmappings/organisations/filterConditionProcess.js +++ b/entity/Person_entity/recordcontainers/db/recordfieldmappings/organisations/filterConditionProcess.js @@ -1,6 +1,10 @@ import("system.vars"); import("system.result"); -var from = "CONTACT join ORGANISATION on (ORGANISATION.ORGANISATIONID = CONTACT.ORGANISATION_ID)"; +var sqlStr = "select PERSON_ID from CONTACT where ORGANISATION_ID in " + + " (select CONTACT.ORGANISATION_ID from CONTACT " + + " join ORGANISATION on (ORGANISATION.ORGANISATIONID = CONTACT.ORGANISATION_ID) " + + " where PERSON_ID is null and " + vars.get("$local.condition") + ")" + + " and PERSON_ID is not null"; -result.string("PERSONID in (select CONTACT.PERSON_ID from " + from + " where " + vars.get("$local.condition")+ ")"); \ No newline at end of file +result.string("PERSONID in (" + sqlStr + ")"); \ No newline at end of file