Finding Items Using SQL (VB.NET)¶
Finding Items Using SQL (VB.NET)¶
1from impact.Impact import *
2from impact.ImpactCAD import *
3
4my_app = None
5my_app = Application()
6
7# ensure that impact is running and has an active database connection
8if not my_app.isNone():
9 my_db = None
10 my_db = my_app.active_database
11
12 if not my_db.isNone():
13 items = None
14 proj_item = None
15
16 # a simple query
17 str_sql = "D_NAME LIKE 'P0006%'"
18 items = my_db.find_items_by_sql(ipDrawingType.dtProject, str_sql)
19
20 # Wrap variant return items with Impact.py wrapper
21 if items is not None:
22 items = [IDatabaseItem(item) for item in items]
23
24 # output the results to a textbox on the form
25 print(str(len(items)) + " items found.")
26 for proj_item in items:
27 print(proj_item.reference)