Move Kids

See also

Download the script: Files/MoveKids.py

This Python script is designed to work with the Custom SQL script called KidsToMove. It will actually move the children from their current organization to the appropriate organization. The script requires ExtraValueInts called MinMonths and MaxMonths to be put on each organization involved. These are documented on the SQL script referenced below.

See also

The SQL script: Kids To Move.

This script can be run manually, or scheduled on a day of the week and time.

See also

model.ScheduledTime for documentation on how to schedule this to run on a day of week and time.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
sql = model.Content("KidsToMove").replace('1=1', ' moving = 1')

list = q.QuerySql(sql)

print '<table class="table notwide centered">'
print '<tr><th>Name Moved</th><th>From</th><th>To</th></tr>'
row = '<tr><td>{}</td><td>{}</td><td>{}</td></tr>'

for p in list:
    # comment the next line out if you want to test
    model.MoveToOrg(p.PeopleId, p.FromOrgId, p.ToOrgId)
    print row.format(p.Name, p.FromOrg, p.ToOrg)

print '</table>'