Running a query with sql

Running a query with sql
 1# This example prompts the user for some SQL to search by, opens the browser
 2# and performs a query using the specified SQL
 3
 4# Create a local variable for the impact.gui
 5g = impact.gui
 6
 7# Create a local variable for the output toolbox
 8ot = g.output_toolbox
 9
10# Clear the output toolbox
11ot.clear()
12
13# Create a local variable for the default SQL to perform
14sql = "D_NAME like 'FEFCO%'"
15
16# Display an input box allowing the user to modify the SQL or cancel the
17# operation
18sql = VBSCRIPT_FUNCTION_InputBox("Enter SQL to search by:", "SQL Project Search", sql)
19
20# If the user cancelled the operation then the length of 'sql' will be zero
21if len(sql):
22
23    # Add a message to the output toolbox
24    ot.add("Opening browser using sql '" + str(sql) + "'")
25
26    # Open the browser and run the specified query, specify True for the
27    # ExitIfEmpty method parameter so that the browser does not open for queries
28    # that do not return any results
29    g.open_browser_run_query_sql(sql, True)
30
31else:
32
33    # Add a message to the output toolbox
34    ot.add("User cancelled search")
35