DB Access Block
The voice application must open a database before accessing it; therefore, use a DB Open block before the DB Access block in the flowchart to open the database you want to access. The Application Builder displays a warning if you attempt to use a DB Access block to access a database that is not open. Also, if you delete a DB Open block that opens the database for a DB Access block, the DB Access block turns red in the flowchart. A common approach is to use several DB Open blocks at the beginning of a voice application to open all databases the voice application might need to access. Refer to DB Open Block for more information.
The DB Access block works in conjunction with the DB Access Next Record block. The DB Access block runs a database query, retrieves results from the specified database connection, and sets the interaction properties using the column names in SQL statements as key names to retrieve values. The DB Access Next Record block sets the interaction properties for the subsequent rows in the search results until there are no additional rows, at which point the DB Access Next Record block executes the No more items conditional exit.
The block can retrieve and set any number of columns and interaction properties. To set the names of the interaction properties explicitly, use as syntax:
select field 1 as propertyname1, field 2 as propertyname2, ...
The result ends up in interaction properties named after result columns with values from the first row. In the following example, the value aa ends up in the interaction property propertyname1:
select aa as propertyname1 from bb where cc = ‘%propertyname%’
The block can also run INSERT statements but it will use the No Data exit and interaction properties would not be updated as there will be no return rows.
Conditional Exits
The DB Access block has one conditional exit, No Data, which directs the flow of the voice application if the database query cannot retrieve data.
Settings
The DB Access block has the following settings:
•Label - Change the name of the block if needed to uniquely identify the use of this block in the application flowchart.
•DB Connection Name (Required) - The name of the database containing the data to search. This drop-down menu lists the names of every database a DB Access block opens before the DB Access block in the flowchart.
•SQL Statement (Required) - The database query in SQL statement format. May include references to interaction and call properties by inserting the property name between two percent signs (%%). For example, to insert the property DDE_HEAT_CustId, use the following syntax:
SELECT CustType FROM Profile WHERE CustID = STRING(6-LEN('%DDE_HEAT_CustId%'),'0') + '%DDE_HEAT_CustId%'
When configuration for this block is complete, click the Update button to apply the settings.