Update: I may be able to so what I need using complex aliases (basically map a fromPerson and toPerson column to a single person column - assuming that only one of the two will be non-null for a given row).
I'll give it a go. James On Thursday, February 14, 2013, James Piechota wrote: > Thank you both for the replies! > > I completely agree: I'd love to avoid hacking as much as possible! Maybe > my searching skills need some help because these are the issues I hit after > combing through the source: > > 1. > I believe the relationships can go either Person -> PartyGroup or > PartyGroup -> Person - is that right? To simplify use of the view-entity, > I'd like to just have single "person" and "partyGroup" fields (as opposed > to the toPerson, fromPerson, toPartyGroup, fromPartyGroup fields used in > the scrum PartyRelationshipAndPartyDetail entitymodel example) > > 2. > We'll be tracking this employment relationship for customers and other > external contacts and so I don't think I can rely on the human resource > tables. > > I guess what it boils down to is: > > A. Are my search skills crappy, and there does in fact exist an example of > how to query the employment relationship without needing both to and from > fields for both parties? (if so, I'll keep looking!) > > B. Have I misunderstood something fundamental, and there's another way to > get at what I need. > > Thanks again for the replies! > > > On Thu, Feb 14, 2013 at 2:20 AM, Adrian Crum < > [email protected] <javascript:_e({}, 'cvml', > '[email protected]');>> wrote: > >> James, >> >> One thing to always remember: Whatever you are trying to do, there is a >> good chance someone else has already done it. Looking up a party >> relationship is a very common requirement, so there is no need to hack up >> the source code to do it. Just spend some time looking at the current >> implementations - chances are it already exists. >> >> -Adrian >> >> >> On 2/14/2013 9:39 AM, Malin Nicolas wrote: >> >>> Hi >>> >>> You can create a view-entity between Person - PartyRelationship - >>> PartyGroup with non optional relation and a entity-condition on >>> partyRelationshipTypeId = EMPLOYMENT >>> See applications/humanres/**entitydef/entitymodel.xml for example. >>> >>> Nicolas >>> >>> Le 14/02/2013 00:09, James Piechota a écrit : >>> >>>> Hi, >>>> >>>> What's the recommended approach to getting a list of Persons and the >>>> Party >>>> Group that they are in an EMPLOYMENT relationship with? >>>> >>>> Some context: >>>> >>>> Since a Person can be on either end of a PartyRelationship the SQL query >>>> I've cooked up involves Left Joins with OR conditions. >>>> >>>> I've been unable to do this with a view-entity since the view-links >>>> seem to >>>> require at least one AND in any boolean condition (i.e., they require at >>>> least one key-map which gets AND'ed with any provided >>>> entity-conditions). >>>> >>>> I've edited my local install to relax the view-link requirements so that >>>> they just require *some* condition whether from a key-map, >>>> entity-condition >>>> or both. If there isn't a recommended approach to the above, I can look >>>> into opening a JIRA issue and attaching a patch. >>>> >>>> For reference, this is the sort of SQL query I've been trying to build: >>>> >>>> select PERSON.FIRST_NAME, PARTY_GROUP.GROUP_NAME >>>> from PERSON >>>> left outer join PARTY_RELATIONSHIP >>>> on (PERSON.PARTY_ID = PARTY_RELATIONSHIP.PARTY_ID_**FROM or >>>> PERSON.PARTY_ID = PARTY_RELATIONSHIP.PARTY_ID_**TO) and >>>> PARTY_RELATIONSHIP.PARTY_**RELATIONSHIP_TYPE_ID = 'EMPLOYMENT' >>>> left outer join PARTY_GROUP >>>> on (PARTY_GROUP.PARTY_ID = PARTY_RELATIONSHIP.PARTY_ID_**FROM or >>>> PARTY_GROUP.PARTY_ID = PARTY_RELATIONSHIP.PARTY_ID_**TO) and >>>> PARTY_RELATIONSHIP.PARTY_**RELATIONSHIP_TYPE_ID = 'EMPLOYMENT' >>>> >>>> >>> >> >
