Sqlselect

向数据库服务器提交 SQL(结构化查询语言)语句,并返回一个结果。

依赖关系

  • 当需要多行结果时,请使用 Sqlcursor action
  • 查询通常会返回一列或多列数据。 当 CXone 将数据从数据库服务器返回给脚本时,每个单独的列都会存储在一个具有相同名称的变量中。
  • 您需要确定您希望与数据库提供程序建立标准连接、加密连接还是 VPN 连接。
  • 使用 SETDB action选择您想要使查询位于的 DB Connector 组。如果没有 Setdb,则使用默认 CXone 数据库。 该数据库是向所有客户提供的表格的通用字典。

支持的脚本类型

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.

通用

电子邮件 聊天 电话 语音信箱 工作项目 短信 数字

输入属性

这些属性定义操作在执行时使用的数据。

属性

说明

Caption

输入在脚本中唯一标识此操作的短语。 标题显示在脚本画布上的操作图标下方。 The default is the action name.

SQLQuery

将提交到数据库服务器的 SQL 语句。 预计此语句应当会返回记录。

GlobalVariables

未使用。
Publish

发布变量和值。

此属性会发布与联系人相关联的数据库中的所有内容。

如果您希望发布特定数据,请使用 Assign action

TimeoutSec

操作在超时之前等待执行的秒数。 该值必须介于 060

结果分支条件

结果分支条件允许您在脚本中创建分支,以在执行操作时处理不同的结果。

条件

说明

Default

除了脚本满足条件要求其接受其他分支的情况之外,所要采用的路径。 如果未定义操作的其他分支,也会执行此操作。
NoRecords 指定的属性没有值时所采用的路径。 如果数据未从数据库返回,则会发生这种情况。
OnError 操作无法正确执行时所采用的路径。 例如,出现连接不良、语法错误等意外问题时。 _ERR 变量以单个下划线字符填充,应包含对问题的简要解释。
OnTimeout 在指定的秒数内没有响应时所采用的路径。

脚本示例

这是一个示例,说明如何在脚本中使用此操作。 它并不是一个完整的脚本。 可能还需要编写其他脚本。

此示例显示了可与脚本中的 SQLSELECT 操作一起使用的逻辑。 SETDB 操作定义包含要查询的数据库的 DB Connector 组。 SQLSELECT 提交查询或存储过程。 它向脚本返回一条记录。 SELECT 语句中标识的数据将被作为单独的变量和值返回到脚本。

此示例中的 SNIPPET 操作将包含适当处理每个分支的逻辑。 当查询没有返回结果时,将采用 NoRecords 分支。

下载此脚本