Update Counter

Updates a counter previously created in the IBM RPA Control Center by incrementing or decrementing the value that is stored by the counter, which displays real-time runtime data through Dashboards.

Command availability: IBM RPA SaaS and IBM RPA on premises

Description

Updates a counter previously created in the IBM RPA Control Center by incrementing or decrementing the value that is stored by the counter, which displays real-time runtime data through Dashboards.

The IBM RPA Dashboard is a script runtime management environment that allows you to monitor your bots based information such as, computer Id, computer name, start and end of the bot's runtime, schedules names, and many other specific data sources.

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.

updateCounter --project(String) --counter(String) --value(Numeric)

Dependencies

Starting from version 23.0.9, you must have permission to access the project that contains the counter that you want to use, otherwise you can't update the counter.

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.

Script Designer Required Accepted types Description
project Project Required Text Enter the name of the Project to which the counter belongs to.
counter Counter Required Text Name of the counter created in IBM RPA Control Center and linked to a dashboard. Counters update and receive real-time bot runtime data so that current values are displayed through the IBM RPA's dashboard.
value Value Required Number Value to increment or decrement of the current value that is stored by the counter.

Example

In the following example, the command updates three counters (numberOfInvoicesIssued, invoicesIssuedValue, and invoicesErrorsQuantity) previously created in the Invoice Issuance project. Each time the script run these commands, they update the project counters, showing real-time runtime data through dashboard charts.

defVar --name value --type Numeric
defVar --name errorCase --type Numeric
defVar --name loop --type Numeric
defVar --name errorNumber --type Numeric
generateRandomNumber --minimum 1 --maximum 10 errorCase=value
for --variable ${loop} --from 1 --to 100 --step 1
	incrementVar --number ${errorNumber}
	generateRandomNumber --minimum 10 --maximum 9999 value=value
	if --left "${errorNumber}" --operator "Equal_To" --right "${errorCase}" --negate
		updateCounter --project "Invoice Issuance" --counter numberOfInvoicesIssued --value 1
		updateCounter --project "Invoice Issuance" --counter invoicesIssuedValue --value ${value}
	else
		updateCounter --project "Invoice Issuance" --counter invoicesErrorsQuantity --value 1
		generateRandomNumber --minimum 1 --maximum 10 errorCase=value
		setVar --name "${errorNumber}" --value 0
	endIf
next
Note:To run the sample script, you must create the project and the counters on IBM RPA Control Center so that they can be accessed during script runtime.