Skip to main content
Roberty Studio
RPAModules

Database

Database

The Database module is responsible for storing persistent data on the computer where the robot is being executed.

Methods​

insertData​

Method responsible for inserting a value into the database.

js
const insert = await Database.Robot.save["v1_0_1"]({
key: "Nome",
value: "Roberty"
})

Required parameters​

  • key: String|Number - key to identify the value stored.
  • value: Any - value that will be stored. It can be any type.

Optional parameters​

  • robotKey: String - key to name the database. If it is not filled in, the robot key is used as the default.

Return​

The constant or variable created, such as the insert of the example shown earlier, receives a value of the Object type. The object returned has the following properties:

  • insert.key: string - returns the key of the value stored.
  • insert.value: Any - returns the value stored.

removeData​

Method responsible for removing a value from the database.

js
await Database.Robot.delete["v1_0_1"]({
key: "Nome"
})

Required parameters​

  • key: String|Number - key of the value to be removed.

Optional parameters​

  • robotKey: String - key referring to the database name. If it is not filled in, the robot key is used as the default.

Return​

This action has no return.

countData​

Method responsible for counting how many values are stored in the database.

js
const count = await Database.Robot.count["v1_0_0"]({})

Required parameters​

There are no required parameters.

Optional parameters​

  • robotKey: String - key referring to the database name. If it is not filled in, the robot key is used as the default.

Return​

The constant or variable created, such as the count of the example shown earlier, receives a value of the Number type representing how many values are stored.

getData​

Method responsible for getting a value of the database.

js
const find = await Database.Robot.find["v1_0_1"]({
key: "Nome"
})

Required parameters​

  • key: String|Number - key of the value to be retrieved.

Optional parameters​

  • robotKey: String - key referring to the database name. If it is not filled in, the robot key is used as the default.

Return​

The constant or variable created, such as the find of the example shown earlier, receives the value stored for the key provided directly (Any). If the key does not exist, the return is undefined.

getAllKeys​

Method responsible for getting every key of the database.

js
const getKeys = await Database.Robot.getAllKeys["v1_0_0"]({})

Required parameters​

There are no required parameters.

Optional parameters​

  • robotKey: String - key referring to the database name. If it is not filled in, the robot key is used as the default.

Return​

The constant or variable created, such as the getKeys of the example shown earlier, receives a value of the String[] type with every key stored in the database.

getAllValues​

Method responsible for getting every value of the database.

js
const getValues = await Database.Robot.getAllValues["v1_0_0"]({})

Required parameters​

There are no required parameters.

Optional parameters​

  • robotKey: String - key referring to the database name. If it is not filled in, the robot key is used as the default.

Return​

The constant or variable created, such as the getValues of the example shown earlier, receives a value of the Array type with every value stored in the database.

clear​

Method responsible for removing every value from the database.

js
await Database.Robot.clear["v1_0_0"]({})

Required parameters​

There are no required parameters.

Optional parameters​

  • robotKey: String - key referring to the name of the database. If it is not filled in, the robot key is used by default.

Return​

This action has no return.