Edit an EnumList then Add/Edit/Delete child rows?

rheric
New Member

I’m working on an Attendance app and have hit a snag. I’ve been able to successfully configure my app with parent/child/grandchild relationships, including a cascading delete (deleting the parent deletes the children AND grandchildren). The data looks like this:

Meeting (MeetingID (uniqueid), Date, Coordinator(ref))

  • Meeting1, 9/28/2020, 212cc3e4
  • Meeting2, 9/29/2020, fee07812

Attendance (AttendanceID (uniqueid), MeetingID (ref to Meeting), MemberID (EnumList of type Ref), NumberAttendees, Copied)

  • Attendance1, Meeting1, {87ebfeca,113f261d,056584ec}, 3, 3
  • Attendance2, Meeting2, {056584ec,7668ce1a}, 2, 2

I use the NumberAttendees and Copied values in a set of Actions to loop through Attendance[MemberID] EnumList and create grandchild records in a third table:

MemberAttendance (MemberAttendanceID, MeetingID (Ref to Meeting table), AttendanceID (Ref to Attendance table), MemberID (Ref to Member table), Deleted (Yes/No))

  • 92adc60c, Meeting1, Attendance1, 87ebfeca, FALSE
  • b83735aa, Meeting1, Attendance1, 113f261d, FALSE
  • d18a4808, Meeting1, Attendance1, 056584ec, FALSE
  • 038f9679, Meeting2, Attendance2, 056584ec, FALSE
  • 417082d0, Meeting2, Attendance2, 7668ce1a, FALSE

(I added the Deleted field to this table to prevent confirmation dialogs when trying to delete records, so “deleting” a record is really just flagging it as removed)

What works so far is I create a Meeting, then add Attendees, which adds the related row to Attendance, which fires an Action that loops through the MemberID list and adds a row to MemberAttendance for each attendee. As I mentioned above, cascading deletes work as well - if I delete a Meeting, all related child and grandchild records are deleted.

What I’m struggling with now is if we need to edit the list of attendees after the fact - if we need to add or remove someone from the Attendance[MemberID] EnumList. I prefer to keep the Member -> Attendance relationship a one-to-one and not create a second (or third) Attendance record.

What I’ve found is that editing an EnumList doesn’t append new values to the list, it apparently rebuilds the list of MemberIDs in the order in which members exist in the Member table. So the loop I use when adding an Attendance record doesn’t work when I need to EDIT an Attendance record.

What I’m looking for are expressions that will help me determine:

  1. When a MemberID value exists in the Attendance[MemberID] list but does NOT exist in MemberAttendance (someone has been ADDED to the Meeting) OR
  2. When a memberID value exists in the MemberAttendance table but does NOT exist in the Attendance[MemberID] list (someone has been DELETED from the Meeting).

I’m more than willing to build multiple looping actions - I already set this up to use one loop for Add (the initial creation of the Attendance record) versus Edit (modifying an existing Attendance record).

Any help would be massively appreciated!

0 0 194
0 REPLIES 0
Top Labels in this Space