Prayer Requests

This script runs from the Main Menu if added to the Menu It shows a person and any prayer requests in the last seven days.

The prayer request is stored in an Extra Value Text field called Prayer Request. It works by searching for a date in the format m/d/yy within the text of the request matching any one of the last 7 days including today.

The comment at the top of the script ensures that this report can only be run by a Admin user.

The recommended name is PrayerRequests

Use the following code to Create the SQL Script. See How to create a SQL Script.

--Roles=Admin
SELECT
    p.PeopleId
    ,p.Name
    ,Email = p.EmailAddress
    ,Cell = dbo.FmtPhone(p.CellPhone)
    ,Home = dbo.FmtPhone(p.HomePhone)
    ,Birthdate = dbo.DOB(p.BirthMonth, p.BirthDay, p.BirthYear)
    ,Data Request
FROM dbo.PeopleExtra e
JOIN dbo.People p ON p.PeopleId = e.PeopleId
WHERE Field = 'Prayer Request'
AND (
   Data LIKE '%' + FORMAT(GETDATE(), 'M/d/yy') + '%'
OR Data LIKE '%' + FORMAT(DATEADD(d,-1,GETDATE()), 'M/d/yy') + '%'
OR Data LIKE '%' + FORMAT(DATEADD(d,-2,GETDATE()), 'M/d/yy') + '%'
OR Data LIKE '%' + FORMAT(DATEADD(d,-3,GETDATE()), 'M/d/yy') + '%'
OR Data LIKE '%' + FORMAT(DATEADD(d,-4,GETDATE()), 'M/d/yy') + '%'
OR Data LIKE '%' + FORMAT(DATEADD(d,-5,GETDATE()), 'M/d/yy') + '%'
OR Data LIKE '%' + FORMAT(DATEADD(d,-6,GETDATE()), 'M/d/yy') + '%'
)