Question

Photo of Robbie Funderburk

0

Attendance Trials...

With the advent of eRA we treat weekly attendance tracking very seriously.  We have Connection Cards and have written a workflow to capture that info and place those folks into a group and they are marked as attended.   We are actually going through that group every week as a staff and checking who we saw in attendance at a weekend service who may not have turned in a Connection Card.   What is the best way to have my Serving Teams show up as attended within that group?  Looking to have all the adults that attended and we know it to show up as a checked name in that group.

  • Photo of Michael Garrison

    1

    First off, this answer is for Robbie but also for anyone else who wants something similar in the future. I've established some information with Robbie outside this thread that I'll reference in here generally to help illustrate the process. I do highly recommend you consider using Attendance Analytics to create reports, rather than having one "master group" with copies of attendance logged elsewhere, but since Rock allows you to do virtually anything you want and in this case this is the method the church wants to use, here's how to do exactly what you asked for: copying attendance data from one group to another.

    I think the best process for this type of work is going to be setting up an automatic workflow and tying it to one or more triggers.

    I've set up a demo on the http://rock.rocksolidchurchdemo.com site so you can see it in action (until the next time the site is reset): 

    The fake checkin group is at http://rock.rocksolidchurchdemo.com/page/113?GroupId=4201&ExpandedIds=4200
    See the "master" attendance group at http://rock.rocksolidchurchdemo.com/page/113?GroupId=4202&ExpandedIds=4200
    See the workflow at http://rock.rocksolidchurchdemo.com/page/136?workflowTypeId=2016

     After talking with Robbie in Slack, we identified that the best way to filter out just the data he wants to copy is by using schedules (they have 10 groups, 10 kiosks but only 3 schedules that the check-ins to be synched to the "master attendance" group were using). We used the following query to identify which schedules we needed:

    SELECT s.[Id],s.[Name],s.[WeeklyDayOfWeek],s.[WeeklyTimeOfDay],x.* FROM (
        SELECT ScheduleId,COUNT(*) "count" FROM [Attendance] GROUP BY [ScheduleId]
        ) x
    LEFT JOIN [Schedule] s ON s.[Id]=x.[ScheduleId]
    ORDER BY x.[count] DESC

     Robbie, you may recall that we are going to use the Schedules with IDs 4614, 2630 and 60 in your case.

     The first thing we need to do is set up the workflow, then we can set up the trigger(s).

     In the demo site I put the workflow under "Samples" but obviously you can put your workflow under any category that fits your ministry.

    Make it automatically persisted, then change the Work Term and Icon as/if you wish (I used Sync Record as the work term and fa fa-copy as the icon CSS Class).

     Create 5 attributes:
    - Attendance Record (a text field type)
    - Did Attend (a Boolean field type)
    - Attended (a Person field type which should be shown in the grid)
    - Master Attendance Group (a Group field type which should be set to default to your Master Attendance group)
    - Attendance DateTime (a DateTime field type)

    I called the first activity "Set Attributes" (you can also do this in one big activity easily enough, change the name as you see fit)

     

    The first action we need is to check and see if the attendance record indicates that they actually attended the group. Use an "Attribute Set From Entity" action to set your "Did Attend" attribute, using a Lava template of {{ Entity.DidAttend }}

    GetDidAttend.PNG

     

    Next, we'll check that attribute and delete this workflow if it doesn't indicate that they attended.

    Add an action called "End if not DidAttend" (or whatever makes more sense to you), the action type should be of type "Workflow Delete". Set both the Action and Activity to be "Completed on Success", then click the "filter" icon in the action's gray title bar. Set it to run if "Did Attend" is "Not Equal To" "True". That way, if they DID attend, this action will be skipped. Nifty!

    EndIfNotDidAttend.PNG

     

    Now we know that we're definitely going to be storing attendance. So let's get the rest of the attributes set that we need.

    We want the synced attendance to have the same timestamp as the original, so let's store that. Create an action of type "Attribute Set from Entity", to set the "Attendance DateTime" attribute, using the Lava Template of {{ Entity.StartDateTime }} 

    StoreAttendanceDateTime.PNG

     

     Unfortunately, getting the person is slightly more abstract than this- it takes two steps. First we need to store the GUID of the attendance record (the Entity)- there's no "Attendance" field type so we'll just store it in Text. Create another "Attribute Set from Entity" action, setting "Attendance Record". Leave Lava Template blank this time.

    StoreAttendanceRecord.PNG

    Then we can add the second action to actually set the person- make this action a "SQL Run" action type (under Utilities)

    Use this query:

    SELECT
        pa.[Guid]
    FROM
        [PersonAlias] pa
        LEFT JOIN [Attendance] a ON a.[PersonAliasId]=pa.[Id]
    WHERE a.[Guid]=CAST('{{ Workflow | Attribute:'Attendancerecord' }}' as uniqueidentifier)

    And set the Result Attribute to "Attendee"

    SetPerson.PNG

     

     OK, I like having my information gathering in one activity and the actual work in another, but since the work is a single step, you could just as easily have them in a single activity. If you want to separate them as I did, create a new Activity called "Sync Attendance", then add a final action to the first Activity of type "Activate Activity". Check that both the action and the activity are completed on Success, and set the Activity to "Sync Attendance". Or skip this step entirely. =)

    ActivateSync.PNG

     

    Now, to actually mark the attendance. Create a final Action in the second Activity (or at the end of the first activity if you skipped the above step) of type "Group Member Attendance Add". It should set both the Activity and Action to complete upon success.

    Set the "Group" to "Master Attendance Group", the "Person" to "Attendee", the Attendance Date/Time to "Attendance DateTime", leave "Location" blank, and set "Add to Group" to "Yes". That way if someone checks in and they aren't already in your Master Attendance group, they'll be added as a member AND be marked as present.

    StoreAttendance.PNG

    That's the end of the workflow definition! click Save at the bottom and heave a sigh of relief. You're almost done.

    SyncWorkflowCompleted.PNG

     

     

    The only thing left is to automatically trigger the workflow.

    Go to "Workflow Triggers" (Admin Tools -> General Settings -> Workflow Triggers) and click the (+) button to add a new trigger.

    For the sample, I used an "Immediate Post-Save" trigger type, but in general the default "Post-Save" should work just fine- it will run the workflow within a minute or two of the check-in, which is just fine.

    Set the Entity Type to "Attendance" and choose the workflow we just created as the "Workflow Type". Leave Workflow Name blank, but set the "Entity Type Qualifier Column" to "ScheduleId". Then set the value to the first Schedule ID that we identified using the SQL at the top of this post (4614 in your case).

    Hit save, and then repeat creating a trigger for each of the other two ScheduleID numbers (2630 and 60).

    SyncWorkflowTrigger.PNG

     

     

    Now, whenever someone checks into a group using one of those three ScheduleIds, Rock will automatically fire your workflow, pointing it to the specific Attendance Record which informs it which person and time should be marked in your Master Attendance group.

     

    You can test it on the Demo site by going to the Fake checkin group at http://rock.rocksolidchurchdemo.com/page/113?GroupId=4201&ExpandedIds=4200 and clicking the "Mark Attendance" button. Set one of the two members already in that group as present and save it. Then jump over to the sibling group called "Master Attendance Group" and you should see (immediately, since I used "Immediate Post-Save") that they were added to the group and marked as present. Also, hop over to http://rock.rocksolidchurchdemo.com/page/288?WorkflowTypeId=2016 and you can see that the only sync record is for the person who actually attended; the workflow for the person who didn't was automatically deleted.

     

    Let me know if you have any questions =) 

    • Robbie Funderburk

      The amount of time you spent helping me through this is remarkable. Not only do I have a solution to our situation but in this process I have "gotten my hands dirty" in workflows. Workflows has been the door to Narnia that I have been afraid to walk through. Putting this on the demo site was a stroke of genius as well! I can not thank you enough for your time and your assistance!

    • Michael Garrison

      Very glad it worked out for you =) I've got a few similar doorways I haven't cracked yet, myself, but it's nice that everything in Rock has proven to be approachable once you take the time to work through them.

  • Photo of Michael Garrison

    0

     Out of the box, Rock's serving team group type is configured to count as weekend attendance, which eRA uses. Can you use the Attendance Analytics tool to generate reports of everyone who attended on a weekend, rather than having a single group be the be-all-end-all of weekend attendance? Otherwise you're going to have to be pulling in people who checked in at kiosks to that group, which seems to be a potential waste of time and space since their attendance is already recorded (simply in a different group).

    • Robbie Funderburk

      Michael the problem is that we need to have a list just like the one the group attendance makes. I am just looking for a way to see the people who were there AND the people who did not use the checkin system so that we can manually enter their attendance. I realize that everyone that uses the checkin system, including our serving teams, has their attendance recorded, but at this point I would rather see their name and have a check in their box than not having their name on the list. Once we are over 1000 attendees this will not be practical at all but for now it actually helps with ministry as it sparks conversation within our staff as we go through this list.