The Query Parameter

There are a number of functions that take a query parameter which can be one of the following:

  • The name of a saved query

  • A PeopleId, thus returning one person

  • The actual Query Code for the query.

PeopleId Example:

p = q.QueryList(828612)
print p.Name

This would result in the variable p having list of 1 Person object.

Query Code Example 1:

print q.QueryCount('''
    MemberStatusId = 10[Member]
    AND GenderId = 1[Male]
''')

This would return the count of all male members.

Query Code Example 2:

pids = "1,2"
query = "peopleids='{}'".format(pids)
for p in q.QueryList(query):
    print p.Name, "<br>"

This would print the Name for each of the two persons referenced by pids.

You can compose a query using The Search > New Search and then use the View Code link to get the code used for this function.