Counting items¶
Counting items¶
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 active database
8db = impact.active_database
9
10# Define the sql where clause to search by
11sql = "D_NAME like 'e'"
12
13# Add a message to the output toolbox
14ot.add("Counting items by sql '" + str(sql) + "'")
15
16# Count the number of items matching the specified sql where clause
17count = db.count_items_by_sql(ipDrawingType.dtProject, sql)
18
19# Display the results in the output toolbox
20ot.add("Found " + str(count) + " item(s) matching SQL " + str(sql))
21
22