Process operations
This topic provides information on the process operations that can be used in a bot.
Counter
Counts the numbers starting with the Initial Value using the specified step. The current number is saved in bot agent’s memory. This operation has the following properties.
| Property name | Type | Description |
| Description | String | Displayed name of the operation. This property is only used in the HMI and has no effect at run-time. |
| Key | String | Unique reference to the value in memory. This property supports usage of internal bot variables. |
| Scope | Enum |
Accessibility scope of value in memory. The following values are available.
|
| Initial value | Double | The initial value used when the specified variable is not defined. This property supports usage of internal bot variables. |
| Direction | Enum | Specifies whether to increase or decrease the current value. |
| Step | Double | The value added or subtracted from the current value on every call of the operation. This property supports usage of internal bot variables. |
Option picker
Switch between several options and put the current one in the bot agent’s memory. The current item could then be used via substitution mechanism. This operation has the following properties.
| Property name | Type | Description |
| Description | String | Displayed name of the operation. This property is only used in the HMI and has no effect at run-time. |
| Key | String | Unique reference to the value in memory. This property supports usage of internal bot variables. |
| Values | Set | List of values to enumerate. Each time the operation is executed, the next value is written to the Bot’s agent memory. This property supports usage of internal bot variables. |
| Scope | Enum |
Accessibility scope of value in memory. The following values are available.
|
Convert value
Compare the result of an expression with specified cases and put the corresponding value in the bot agent’s memory. This operation has the following properties.
| Property name | Type | Description |
| Description | String | Displayed name of the operation. This property is only used in the HMI and has no effect at run-time. |
| Key | String | Unique reference to the value in memory. This property supports usage of internal bot variables. |
| Scope | Enum |
Accessibility scope of value in memory. The following values are available.
|
| Input values | C# lambda expression | C# lambda expression – function taking the current bot agent context as an input and returning the value compared after with specified cases. This property supports usage of internal bot variables. The initial part of the expression (i.e. “x => ”) is automatically added if necessary. |
| Cases | Set | List of values to compare with, and corresponding values to save in bot’s memory. Both Case and Value properties support usage of internal bot variables. |
Save to memory
Saves a result of the given expression in the bot agent’s memory. The saved items could then be used via substitution mechanism. This operation has the following properties.
| Property name | Type | Description |
| Description | String | Displayed name of the operation. This property is only used in the HMI and has no effect at run-time. |
| Key | String | Unique reference to the value in memory. This property supports usage of internal bot variables. |
| Value expression | C# lambda expression | C# lambda expression – function taking the current bot agent context as an input and returning the value compared after with specified cases. This property supports usage of internal bot variables. The initial part of the expression (i.e. “x => ”) is automatically added if necessary. |
| Scope | Enum |
Accessibility scope of value in memory. The following values are available.
|
A custom C# script can be used in the Value expression property. This allows a user to easily and flexibly define a value to save in memory depending on the current bot context.
Refer to the following table for examples of what kind of expressions can be used in this operation. See the topic Smart Bot expression reference for the full description of the scripting API.
| Expression | Description |
| x => x.BotName x => | Name of the current Smart Bot. |
| x.Chat.ChatId x => | Surrogate Identifier of the chat room. |
| x.Chat.ChatNamex => | Displayed Identifier of the chat room. |
| x.Chat.Descriptionx => | Displayed Title of the chat room. |
| x.Chat.ColorString x => | HEX code of the color assigned to a chat. |
| x.Chat.ChatAccess | Accessibility of the chat room. Type: List<ChatAccess>. All usual properties and methods of generic lists can be applied. |
| x => x.Chat.ChatAccess[0] | Accessibility of the first participant in the chat room. Type: ChatAccess |
| x => x.Chat.ChatAccess[0].UserId | Unique identifier of the first participant in the chat room. |
| x => x.Chat.ChatAccess[1].CreationDate | Entry date of the second participant in the chat room. |
| x => x.Chat.ChatAccess[1].Access | Access level of the second participant in the chat room. |
| x => x.Chat.StorageTimeOfMessages | Maximum time an old message can remain in the chat, in minutes, null for infinite. |
| x => x.LastMessage.MessageId | Unique identifier of the message. Type: System.Guid. |
| x => x.LastMessage.DeviceId | Unique name of the device/station used to send the message. |
| x => x.LastMessage.DeviceDisplayName | Displayed identifier of the device/station used to send the message. |
| x => x.LastMessage.ZoneId | Sender’s location when the message was sent. |
| x => x.LastMessage.Sender | User name of the message sender. |
| x => x.LastMessage.DateOffset | Local timestamp of the message. |
| x => x.LastMessage.Date | UTC timestamp of the message. |
| x => x.LastMessage.Type | Type of the message. |
| x => x.LastMessage.Text | Content of the text messages or filename for attachments. |
| x => x.LastMessage.FilePath | Full path to the attachment file. |
| x => x.LastMessage.TotalBytes | Size of the message attachments in bytes. |
| x => x.LastMessage.Extra | Extensions of the message, such as auto-response options. XML format. |
| x => System.DateTime.Now | The current date and time. |
| x => System.DateTime.Now.ToStrint(“d”) | The current date and time formatted to the current culture. Refer to Standard date and time format strings Microsoft documentation for more formatting options. |
| x => x.Context.User | The username of the user in the current context of a “User information changed” condition. |
| x => x.Context.LastValue | The previous value of the specified property in the current context of a “property changed” type of condition. |
| x => x.Context.NewValue |
The new value of the specified property in the current context of a “property changed” or “multiple choice” types of condition. Examples:
|
| x => x.Variable(“@Branch .Bit01”) | Value of the variable named Branch.Bit01. The variable name is prefixed with the current bot’s branch unless the @ symbol is used. |
| x => x.HistoricalAt(“@Branch .Register01”, “Unit01”, new DateTime(2019, 1, 1)) |
Value of the variable named Branch.Register01 at the specified date. The variable name is prefixed with the current bot’s branch unless the @ symbol is used. Note that Smart Bots access Historical data using a unified API, so they can receive data from ANY archiving supported Unit type. |
| x => x.Historical(“Branch .Register01”, “Unit01”, new DateRange(10, Intervals.Seconds)) | List of data points of the variable named Branch.Register01 during the last 10 seconds including values having a bad quality or NS. The variable name is prefixed with the current bot’s branch unless the @ symbol is used. |
| x => x.Historical(“Branch .Register01”, “Unit01”, new DateRange(10, Intervals.Hours)).Padding(1, Intervals.Minutes) | List of all data points of the variable named Branch.Register01 during the last 10 hours with Padding of 1 minute applied: i.e. data is spread over the last 10 hours with 1 data point every minute. The variable name is prefixed with the current bot’s branch unless the @ symbol is used. |
| x => x.Historical(“Branch .Register01”, “Unit01”, new DateRange(new DateTime(2019, 1, 1), new DateTime(2019, 1, 31))) | List of data points of the variable named Branch.Register01 during the period from 1 January 2019 to 31 January 2019 including values having a bad quality or NS. The variable name is prefixed with the current bot’s branch unless the @ symbol is used. |
Call procedure
Executes another Smart Bot procedure. Result of the procedure call is saved in the bot agent’s memory. The saved items could then be used via substitution mechanism. This operation has the following properties.
| Property name | Type | Description |
| Description | String | Displayed name of the operation. This property is only used in the HMI and has no effect at run-time. |
| Branch | String | Branch name assigned to the executed Smart Bot. The branch will be prefixed with the current bot’s branch unless the @ symbol is used. |
| Procedure path | String | Path to the Smart Bot blueprint file to be executed. This property supports usage of internal bot variables. The specified path is relative to the following directory: <projectFolder>\MsgData\Bots |
| Result key | String | Unique reference to the procedure result in memory. This property supports usage of internal bot variables. |
| Scope | Enum |
Accessibility scope of value in memory. The following values are available.
|
| Parameters list | Set | List of internal variables and corresponding values that will be predefined in the executed Smart Bot. Both variable name and value properties support usage of internal bot variables. List of internal variables is automatically prefilled with the unset internal variables of the executed Smart Bot. Feel free to modify the list, if necessary. |
The calling Smart Bot waits until the executing procedure is completed. To run the Smart Bot in parallel use the Invite User to Chat operation.
Stop procedure
Stops the current Smart Bot procedure and the current bot agent. Specified result can be returned to the calling Smart Bot in case where the Call operation was used. This operation has the following properties.
| Property name | Type | Description |
| Description | String | Displayed name of the operation. This property is only used in the HMI and has no effect at run-time. |
| Result | String | Value to return to the calling Smart Bot in case where Call operation was used. This property supports usage of internal bot variables. |