GivingForecastData Python Script

To install this script, copy all of the code below. Create a new Python document in Special Content using the name GivingForecastData. Then paste the code into editor and save.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#Roles=Finance

model.CreateQueryTag('GivingForecast-Members', 
    'FamHasPrimAdultChurchMemb = 1 AND IncludeDeceased = 1')

model.CreateQueryTag('GivingForecast-ActiveNonMembers', 
'''
    ( 
        RecentFamilyAdultLastAttend( Days=365 ) = 1 
        OR IsFamilyGiver( Days=365 ) = 1
    ) 
    AND FamHasPrimAdultChurchMemb = 0 
    AND IncludeDeceased = 1
''')

Sql = model.SqlContent('GivingForecast')

data = q.SqlFirstColumnRowKey(Sql, None)
data.Created = model.DateTime.ToString('g') # record when data was created

savedata = model.FormatJson(data)
model.WriteContentText('GivingForecastData', savedata)

print '<pre>'
print savedata
print '</pre>'

# the following is only used in development 
#Sql = model.Content('C:/dev/bvcmsdocs/source/CustomProgramming/Python/Scripts/Giving/Forecast/Files/Content/GivingForecast.sql')
#runfrom=C:/dev/bvcmsdocs/source/CustomProgramming/Python/Scripts/Giving/Forecast/Files/Content/GivingForecastData.py

© 2019 TouchPoint Software, LLC.  All rights reserved.