Create Storage Adapter
Creates a connection interface to a server or a local database.
Command availability: IBM RPA SaaS and IBM RPA on premises
Description
You can use the adapter as a reference for storing interaction history in a chatbot or data that is associated with Workflow instances.
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.
createStorageAdapter --storageStrategy(StorageStrategies) --dbConnection(DbConnection) (StorageAdapter)=storageAdapter
Dependencies
For Local
storage, you must create a database connection with a valid connection string. Use the following commands according to the database management system (DBMS) you use:
Input parameter
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 |
---|---|---|---|---|
Storage | storageStrategy |
Required |
StorageStrategies |
The location to store the history. See the storageStrategy parameter options. |
Local Storage Connection | dbConnection |
Required only when whenStorage parameter is Local |
Database Connection |
Database connection variable. |
storageStrategy
parameter options
The following table displays the options available for the storageStrategy
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 |
---|---|---|
Both | Both |
Stores the history in memory, with no data persistence. |
Local | Local |
Stores the history in a local database. |
Server | Server |
Stores the history in the IBM Robotic Process Automation database automatically configured in the IBM RPA Control Center. |
Output parameter
Designer mode label | Script mode name | Accepted variable types | Description |
---|---|---|---|
Storage Adapter | storageAdapter |
Storage Adapter |
Returns the storage adapter connection interface. |
Example
The following code example demonstrates how to define a location to store history data for the chatbot feature. It uses the storage adapter to create the connection interface between the server storage and the Connect to Chatbot command.
defVar --name botCulture --type Language
defVar --name storageAdapter --type StorageAdapter
defVar --name userAnswer --type String
// Creates the chatbot culture.
createLanguage --culture "en-US" botCulture=value
// Create the storage adapter to store the history data in the server.
createStorageAdapter --storageStrategy "Server" storageAdapter=storageAdapter
// Connects to the chatbot instance. The storage adapter acts as a connection between the storage location and this command.
botConnect --type "Chat" --language ${botCulture} --storageAdapter ${storageAdapter} --timeout "00:05:00"
// Asks the user and waits for an answer.
botAsk --text "Welcome to IBM. Tell us, which sector do you want to talk to?" --timeout "00:01:00" userAnswer=value
// Logs the user answer on the output pane.
logMessage --message "User answer: ${userAnswer}" --type "Info"
// Disconnects to the chatbot instance.
botDisconnect