Bot Ask Quantity
The bot asks and recognizes quantities and units of measurement in the text provided by the user.
Starting from IBM RPA 23.0.3, support for Interactive Voice Response (IVR) is removed from this command due to the removal of IVR. For more information, see Removed.
Command availability: IBM RPA SaaS and IBM RPA on premises
Script syntax
IBM RPA's proprietary script language has a syntax similar to other programming languages. The script syntax defines the command's syntax in the script file. You can work with this syntax in IBM RPA Studio's Script mode.
botAskQuantity --type(QuantityTypes) --units(String) --fractions(String) [--retry(Boolean)] [--attempts(Numeric)] [--retrytext(String)] [--timeoutsub(String)] [--recognitionTimeout(TimeSpan)] [--speechCompleteTimeout(TimeSpan)] [--noInputTimeout(TimeSpan)] [--speechIncompleteTimeout(TimeSpan)] [--confidenceThreshold(Numeric)] [--beep(Boolean)] [--language(Language)] --text(String) [--textformat(String)] [--timeout(TimeSpan)] (String)=utterance (Boolean)=timedout (String)=botHistoryMessageId (List<Numeric>)=values (Numeric)=first (DataTable)=valuesmapping (Boolean)=success
Dependencies
- You must start a Chatbot or IVR instance by using the Connect to Chatbot (
botConnect
) command. - This command must be in the Connect to Chatbot scope.
Input parameters
The following table displays the list of input parameters available in this command. In the table, you can see the parameter name when working in IBM RPA Studio's Script mode and its Designer mode equivalent label.
Designer mode label | Script mode name | Required | Accepted variable types | Description |
---|---|---|---|---|
Type | type |
Required |
QuantityTypes |
Type of unit of measurement. See type parameter options for details. |
Unit | units |
Required when the Type parameter is enabled |
Text |
Name of the new unit of measurement used. |
Fractions | fractions |
Required when the Type parameter is enabled |
Text |
Enables the "Parameter" and "Value" fields, which perform the conversion of the custom unit of measure that was entered in Unit. The Parameter field receives the custom unit of measure symbol. The Value field receives the default value of the custom unit of measure. Example: Unit of measure in miles. Symbolism: mi Default value: 1.6 |
Retry | retry |
Optional |
Boolean |
Enable to allow the bot to ask a new question if there is no answer on the first attempt. |
Attempts | attempts |
Optional |
Number |
Number of times the question entered in Alternative text is repeated. |
Alternative text | retrytext |
Optional |
Text |
Alternative question to ask the user if there is no answer on the first attempt. |
Time out sub | timeoutsub |
Optional |
Text |
Subroutine that runs if the user's response time runs out. |
Recognition Time out | recognitionTimeout |
Optional |
Time Span |
Timeout to acknowledge the user's response |
Speech Complete Timeout | speechCompleteTimeout |
Optional |
Time Span |
Maximum time allowed without interaction with the robot after its speech. Starting from IBM RPA 23.0.3, this parameter is removed. |
No input timeout | noInputTimeout |
Optional |
Time Span |
Maximum waiting time for the user to start the conversation. Starting from IBM RPA 23.0.3, this parameter is removed. |
Speech Incomplete Timeout | speechIncompleteTimeout |
Optional |
Time Span |
Maximum amount of time to wait for the user to complete the speech. Starting from IBM RPA 23.0.3, this parameter is removed. |
Confidence Threshold | confidenceThreshold |
Optional |
Number |
Numeric expression that indicates the confidence level for recognizing user response. Confidence rate is in the range 1 - 100. If the obtained value is lower than the specified range, it returns null. Starting from IBM RPA 23.0.3, this parameter is removed. |
Beep | beep |
Optional |
Boolean |
Enable to play a beep each time that the bot speaks. Starting from IBM RPA 23.0.3, this parameter is removed. |
Language | language |
Optional |
Language |
Language used for bot communication. Use the Create a Language (createLanguage ) command to get the language variable. |
Text | text |
Required |
Text |
First question to ask for quantity. |
Text Format | textformat |
Optional |
Text , BotTextFormat |
Specifies the text format to send to the chat, either Plain Text or Markdown (default). |
Timeout | timeout |
Optional |
Time Span , Number , Text |
Timeout for waiting for user response. |
type
parameter options
The following table displays the options available for the type
input parameter. The table shows the options available when working in Script mode and the equivalent label in the Designer mode.
Designer mode label | Script mode name | Description |
---|---|---|
Unit | Unit |
Uses unit in general as a unit of measurement. |
Mass | Mass |
Uses mass as a unit of measurement. The Legacy NLP provider converts every mass value to kilograms. |
Distance | Distance |
Uses Distance as a unit of measurement. The Legacy NLP provider converts every distance value to meters. |
Volume | Volume |
Uses Volume as a unit of measurement. The Legacy NLP provider converts every volume value to liters. |
Custom | Custom |
Uses a custom unit of magnitude. |
Output parameters
Designer mode label | Script mode name | Accepted variable types | Description |
---|---|---|---|
Utterance | utterance |
Text |
Returns the text provided by the user. |
Timed Out | timedout |
Boolean |
Returns True if the time has run out, otherwise returns False . |
History Message | botHistoryMessageId |
Text |
Value to link the history of other commands to the history of this command. This field returns the identity value of the saved history if one has been set Storage Adapter at Connect to Chatbot. To use it, simply add this output to the command-specific input parameter from which history you want to link to this command's history. |
Values | values |
List<Number> |
List with the quantitative values recognized in the sentence entered by the user. |
First | first |
Number |
First value indicating the amount recognized in the text. |
Values Mapping | valuesmapping |
Data Table |
Data table that returns value mapping with: - The mapping code; - The position in which the quantitative value was identified; - The length of this value; - The sentence in which the value was recognized; - The numeric value that was recognized. |
Success | success |
Boolean |
Returns True if the script runs successfully, or False otherwise. |
Example
The command asks a question about the distance between two cities, and returns the unit of measurement as a "Distance" type of variable.
defVar --name language --type Language
defVar --name insertedText --type String
defVar --name recognizedNumbers --type List --innertype Numeric
defVar --name firstRecognizedNumber --type Numeric
defVar --name chatBot --type ChatData
createLanguage --culture "enUS" language=value
botConnect --type "Chat" --language ${language} --autoanswer --timeout 00:05:00 chatBot=chat
botAskQuantity --type "Distance" --beep --text "What\'s the distance between New York and Los Angeles?" --timeout 00:05:00 insertedText=utterance recognizedNumbers=values firstRecognizedNumber=first
logMessage --message "First recognized number: ${firstRecognizedNumber}\r\nText: ${insertedText}\r\nRecognized values: ${recognizedNumbers}" --type "Info"
botDisconnect
Limitations
-
In order to recognize the unit properly, the user-entered value must contain the symbol of the specified unit of measurement.
-
If the amount of time specified in the Recognition Time out, No input timeout, Speech Complete Timeout, Speech Incomplete Timeout, and Timeout parameters runs out, the interaction will be forwarded to the subroutine specified in the Time out sub parameter.
-
The Recognition Time out, No input timeout, Speech Complete Timeout, Speech Incomplete Timeout, and Beep parameters for communication type IVR.
-
The Attempts and Alternative text parameters are available when the Retry parameter is enabled.