Counting customers (Python)

Counting customers (Python)
 1# Create a local variable for the output toolbox
 2ot = impact.gui.output_toolbox
 3
 4# Clear the output toolbox
 5ot.clear()
 6
 7# Create a local variable for the customers in the active database
 8customers = impact.active_database.customers
 9
10# Define the sql where clause to search by
11sql = "CS_NAME like 'e'"
12
13# Add a message to the output toolbox
14ot.add("Counting customers by sql '" + sql + "'")
15
16# Count the number of customers matching the specified sql where clause
17count = customers.count_by_sql(sql)
18
19# Display the results in the output toolbox
20ot.add("Found " + str(count) + " customer(s) matching SQL " + sql)