1 Reply Latest reply on Oct 31, 2011 6:15 AM by BarryIrvine

    Multiple relationships via a portal

    BarryIrvine

      Title

      Multiple relationships via a portal

      Post

      I seem to be struggling again with my relationships via a portal.

      I have a Donor entity who can make multiple Donations. A Donation is always linked to a Campaign/Event.

      So Donor->Donation->Event.

      Donation is linked to Donor with donor_id and Event is linked to Donation with event_id.

      On my Donor layout I have a portal to Donation which displays 2 Donations on screen and the rest can be accessed using the scrollbar.

      I'm struggling to set the value of event_id in the correct Donation record. It seems to only update the first Donation record linked to the Donor.

      This is what I did:

      I created a Global field called gEventName in the Donation table (I didn't particularly want this to be global but I couldn't get the find to work otherwise).

      After setting the value of gEventName using the drop-down list, I fire off a setEvent script onObjectModify:

      if [Donation::gEventName ≠ ""]

      Go to Layout ["Event" (Event) ]

      Enter Find Mode []

      Set Field [ Event::event_name; Donation::gEventName]

      Perform Find []

      Set Variable [$EventId; Value:Event::event_id]

      Go to Layout[original layout] #I've also tried going to the Donation layout here too

      Set Field [Donation::event_id; $EventId ]

      Set Field [Donation::gEventName] #Clear the global variable after the find

      End If

      It only updates the event_id/event_name in the first Donation record in the portal - even if I perform the find in the second record.

      Here is a screenshot that may help understand the issue:

       

      Screen_Shot_2011-10-31_at_12.22.19_PM.png