![]() |
Cisco Customer Response Applications Editor Step Reference Guide (3.1)
|
|||||||||||||||||||||||
Database Step Descriptions
![]() |
||||||||||||||||||||||||
|
Table of ContentsDatabase Step DescriptionsDB Get DB Read DB Release DB Write Database Step DescriptionsThe steps in the Database palette of the Cisco Customer Response Applications (CRA) Editor provide script designers with a way to read and write data and/or documents to database tables. This Database palette contains the following steps:
Figure 12-1 shows the steps in the Database palette as they appear in the Palette pane of the CRA Editor. Figure 12-1 Database Palette Steps DB GetUse the DB Get step to assign to specific variables the results of the Structured Query Language (SQL) query that you define in the DB Read step.
Each time the script executes the DB Get step, the script retrieves one row of the results returned by the DB Read step and places them in the variables you assign. To move to the next row in a table, you must execute the DB Get step again. The DB Get step has three output branches:
The DB Get customizer window contains two tabs: The following sections describe these two tabs. GeneralUse the General tab of the DB Get step to specify the DB Resource Name and Data Source Name. Figure 12-2 shows the General tab of the DB Get customizer window. Figure 12-2 DB Get Customizer WindowGeneral Tab Table 12-1 describes the properties of the General tab of the DB Get customizer window. Table 12-1 DB Get PropertiesGeneral Tab To use the General tab of the DB Get customizer window to specify the DB Resource Name and Data Source Name, perform the following procedure: ProcedureStep 1 If necessary, click the General tab. The General tab of the DB Get customizer window appears. Step 2 From the DB Resource Name drop-down menu, choose the DB Resource Name you configured in the DB Read step. Step 3 In the Data Source Name field, enter the name of the desired database. Step 4 Click the Refresh Database Schema button to update the CRA Editor with the fields defined in the selected database. Step 5 Click Apply. You are now ready to configure the Field Selection tab of the DB Get customizer window. Field SelectionUse the Field Selection tab of the DB Get customizer window to identify the fields within the selected query and to choose the variables in which you want to store the value for each field. Figure 12-3 shows the Field Selection tab of the DB Get customizer window. Figure 12-3 DB Get Customizer WindowField Selection Tab Table 12-2 describes the properties of the Field Selection tab of the DB Get customizer. To use the Field Selection tab of the DB Get customizer window to identify fields and to choose the variables in which you want to store the value for each field, perform the following procedure: ProcedureStep 1 If necessary, click the Field Selection tab. The Field Selection tab of the DB Get customizer window appears. Step 2 From the Table Name drop-down menu, choose an available table from the database specified in the General tab of this step. Step 3 Click Add. The Add Database Field dialog box appears. (See Figure 12-4 .) Figure 12-4 Add Database Field Dialog Box Step 4 From the Enter the Field (Column) Name drop-down menu, choose a field. The data type of the selected field appears automatically in the Data Type text field. Step 5 From the Enter the Variable Name to Store this Field drop-down menu, choose the variable you want to assign to the selected field, and then click OK. The Add Database Field dialog box closes, and the field name, data type, and local variable appear in their respective columns in Field Selection tab of the DB Get customizer window. (To modify already existing field and variable information, select the desired field or variable, and click Modify. The Modify Database Field dialog box appears, which contains the same fields as the Add Database Field dialog box and is configured in the same way.) Step 6 Click OK. The DB Get customizer window closes, and the resource name appears next to the DB Get step icon in the Design pane of the CRA Editor. DB ReadUse the DB Read step to choose a database and enter SQL statements required to obtain the data you need for your script. You can use a DB Get step after a DB Read step to assign the results of your query to specific variables.
The DB Read step has three output branches: The DB Read customizer window contains three tabs: The following sections describe these tabs. GeneralUse the General tab of the DB Read customizer window to specify a DB Resource Name and Data Source Name. Figure 12-5 shows the General tab of the DB Read customizer window. Figure 12-5 DB Read Customizer WindowGeneral Tab Table 12-3 describes the properties of the General tab of the DB Read customizer window. Table 12-3 DB Read PropertiesGeneral Tab To use the General tab of the DB Read customizer window to specify a DB Resource Name and Data Source Name, perform the following procedure: ProcedureStep 1 If necessary, click the General tab. The General tab of the DB Read customizer window appears. Step 2 From the DB Resource Name drop-down menu, choose the name that identifies the database query. Step 3 From the Data Source Name drop down menu, choose the name of the desired database. If the Data Source Name drop-down list is empty, click the Refresh Database Schema button to download the schema from the Cisco CRA Engine. Step 4 In the Timeout (In Sec) text field, enter a number to represent the timeout length. Step 5 Click Apply. You are now ready to configure the SQL tab of the DB Read customizer window. SQLUse the SQL tab of the DB Read customizer window to define the SQL SELECT statement required to retrieve the data that you need from the specified database. Figure 12-6 shows the SQL tab of the DB Read customizer window. Figure 12-6 DB Read Customizer WindowSQL Tab Table 12-4 describes the properties of the SQL tab of the DB Read customizer window. To use the SQL tab of the DB Read customizer window to define the SQL SELECT statement, perform the following procedure. ProcedureStep 1 If necessary, click the SQL tab. The SQL tab of the DB Read customizer window appears. Step 2 In the Enter SQL Command to be Executed text field, enter the SQL command you want to be executed, using standard SQL syntax. The SQL statements SELECT count(*) and SELECT min(*) are not supported. Step 3 To test your query and connectivity to the chosen database, click Test. Observe the number of rows returned to determine whether or not your query is working correctly. To test the SQL statement, you must have a connection to an active Cisco CRA Engine. Step 4 To display the fields defined in a particular table in this database, select the table from the Show all fields drop-down list. Step 5 Click Apply. You are now ready to configure the Comments tab of the DB Read customizer window. CommentsUse the Comments tab of the DB Read customizer window to add a text description explaining your script. Figure 12-7 shows the Comments tab of the DB Read customizer window. Figure 12-7 DB Read Customizer WindowComments Tab To use the Comments tab of the DB Read customizer window to enter your comments, perform the following procedure: ProcedureStep 1 If necessary, click the Comments tab. The Comments tab of the DB Read customizer window appears. Step 2 In the Enter Comment Text Here text field, enter your comments. Step 3 Click OK. The DB Read customizer window closes, and the resource name appears next to the DB Read step icon in the Design pane of the CRA Editor. DB ReleaseUse the DB Release step after a DB Get or DB Write step to close a SQL query and release the allocated resources. A released DB connection is returned to the connection pool and data is no longer associated with this connection. Figure 12-8 shows the customizer window for the DB Release step. Figure 12-8 DB Release Customizer Window Table 12-5 describes the properties of the DB Release customizer window. Table 12-5 DB Release Properties
To use the DB Release customizer window to close a SQL query, perform the following procedure: ProcedureStep 1 From the DB Resource Name drop-down menu, choose the DB Resource Name for which you want to release resources. Click the Refresh Database Schema button to update the DB Resource Name drop-down list. Step 2 Click OK. The DB Release customizer window closes, and the resource name appears next to the DB Release step icon in the Design pane in the CRA Editor. DB WriteUse the DB Write step to select a database and enter SQL UPDATE, SQL DELETE, or SQL INSERT statements. You can use this step to update an enterprise database. When you are finished with a database write operation, use the DB Release step to free the connection to the database server. The DB Write step has three output branches: The DB Write customizer window contains four tabs: The following sections describe these tabs. GeneralUse the General tab of the DB Write customizer window to identify the DB Resource Name variable and the database that you want to update. Figure 12-9 shows the General tab of the DB Write customizer window. Figure 12-9 DB Write Customizer WindowGeneral Tab Table 12-6 describes the properties of the General tab of the DB Write customizer window. Table 12-6 DB Write PropertiesGeneral Tab
To use the General tab of the DB Write customizer window to identify the DB Resource Name variable and the database that you want to update, perform the following procedure: ProcedureStep 1 If necessary, click the General tab. The General tab of the DB Write customizer window appears. Step 2 From the DB Resource Name drop-down menu, choose the name that identifies the database query. Step 3 From the Data Source Name drop-down menu, choose the name of the desired database. If the Data Source Name drop-down menu is empty, click the Refresh Database Schema button to download the schema from the Cisco CRA Engine. Step 4 Click Apply. You are now ready to configure the SQL tab of the DB Write customizer window. SQLUse the SQL tab of the DB Write customizer window to define SQL UPDATE, SQL DELETE, or SQL INSERT statements that will update the chosen database. Figure 12-10 shows the SQL tab of the DB Write customizer window. Figure 12-10 DB Write Customizer WindowSQL Tab Table 12-7 describes the properties of the SQL tab of the DB Write customizer window. To use the SQL tab of the DB Write customizer window to define SQL UPDATE, SQL DELETE, or SQL INSERT statements, perform the following procedure. ProcedureStep 1 If necessary, click the SQL tab. The SQL tab of the DB Write customizer window appears. Step 2 In the Enter SQL Command to be Executed text field, enter the SQL UPDATE, SQL DELETE, or SQL INSERT statements, using standard SQL syntax. Step 3 To display the fields defined in a particular table in this database, select the table from the Show all fields drop-down list. Step 4 Click Apply. You are now ready to test your query and connectivity with the Test tab of the DB Write customizer window. TestUse the Test tab of the DB Write customizer window to test your query and connectivity to the chosen database. Figure 12-11 shows the Test tab of the DB Write customizer window. Figure 12-11 DB Write Customizer WindowTest Tab Table 12-8 describes the properties of the Test tab of the DB Write customizer window. To use the Test tab of the DB Write customizer window to test your SQL command string, perform the following procedure. ProcedureStep 1 If necessary, click the Test tab. The Test tab of the DB Write customizer window appears. Step 2 In the SQL Command Entered text field, enter a SQL command. Step 3 Click Execute. The result appears in the Number of Rows Altered text field. Step 4 Observe the figure in the Number of Rows Altered text field. This number indicates whether or not your SQL statements are producing the expected results. Clicking the Execute button in this window does not update the database; this action does nothing but validate the SQL statement. You must be connected to an active CRA server to perform this operation. Step 5 Click Apply. You are now ready to enter comments in the Comments tab of the DB Write customizer window. CommentsUse the Comments tab of the DB Write customizer window to add a text description that explains your script. Figure 12-12 shows the Comments tab of the DB Write customizer window. Figure 12-12 DB Write Customizer WindowComments Tab To use the Comments tab of the DB Write customizer window to enter your comments, perform the following procedure: ProcedureStep 1 If necessary, click the Comments tab. The Comments tab of the DB Write customizer window appears. Step 2 In the Enter Comment Text Here text field, enter your comments. Step 3 Click OK. The DB Write customizer window closes, and the resource name appears next to the DB Write step icon in the Design pane of the CRA Editor.
|
|||||||||||||||||||||||
|
|