Sqlselect

This help page is for Desktop Studio. This information is also available for CXone Studio.

Submits a SQL (Structured Query Language) statement to a database server and returns a single result.

Dependencies

  • Use a Sqlcursor action when multiple row results are required.
  • A query typically returns one or more columns of data. When CXone returns the data from the database server back to the script, each individual column is stored in a variable with the same name.
  • You will need to determine if you want a standard, encrypted, or VPN connection to your DB Provider.
  • Use the SETDB action to choose the DB Connector group you want to make queries in. Without Setdb the default CXone database is used. This database is a generic dictionary of tables provided to all customers.

Supported Script Types

The icon for a Generic script type - a rectangle with < and > symbols inside it.

The icon for the Email script type - a large @ symbol in a diamond.

The icon for the Chat script type - a chat bubble with an ellipsis inside (...), in a diamond shape.

The icon for the Phone script type - an old-style phone handset with curved lines indicating sound coming out of it.

The icon for the Voicemail script type - a symbol that looks like a cassette tape - two circles sitting on a horizontal line.

The icon for the Work Item script type-a piece of paper with one corner folded down and a bullet list on it.

The icon for the SMS script type - a smart phone with a chat bubble coming out of it.

The icon for the Digital script type - a computer monitor with a smartphone next to it.

Generic

Email Chat Phone Voicemail Work Item SMS Digital

Input Properties

These properties define data that the action uses when executing.

Property

Description

Caption

Enter a short phrase that uniquely identifies this action in the script. The caption appears on the script canvas under the action icon. The default is the action name.

SQLQuery

The SQL statement that will be submitted to the database server. This statement should be expected to return records.

GlobalVariables

Not used.
Publish

Publishes a variable and value.

This property publishes everything in the database associated with a contact.

If you want to publish specific data, use the Assign action.

TimeoutSec

The number of seconds the action waits to execute before timing out. The value must be between 0 and 60.

Result Branch Conditions

Result branch conditions allow you to create branches in your script to handle different outcomes when an action executes.

Condition

Description

Default

Path taken unless the script meets a condition that requires it to take one of the other branches. It is also taken if the action's other branches are not defined.
NoRecords Path taken if there are no values for the specified properties. This happens when data is not returned from the database.
OnError Path taken when the action fails to execute properly. For example, when there is an unexpected problem such as poor connectivity, syntax errors, and so on. The _ERR variable, with a single underscore character, should be populated with a condensed explanation of the problem.
OnTimeout Path taken if there is no response for the number of seconds specified.

Script Example

This is an example to show how this action can be used in scripts. It is not intended to be a complete script. Additional scripting may be required.

This example shows logic that can be used with the SQLSELECT action in your script. The SETDB action defines the DB Connector group that contains the database you want to query. SQLSELECT submits a query or stored procedure. It returns a single record to the script. Data identified in the SELECT statement is returned to the script as individual variables and values.

The SNIPPET actions in this example would contain logic to handle each branch appropriately. The NoRecords branch is taken when there are no results returned by the query.

Download this script.