- Release notes
- Getting started
- Installation
- Configuration
- Integrations
- Authentication
- Working with Apps and Discovery Accelerators
- AppOne menus and dashboards
- AppOne setup
- TemplateOne 1.0.0 menus and dashboards
- TemplateOne 1.0.0 setup
- TemplateOne menus and fashboards
- TemplateOne 2021.4.0 setup
- Purchase to Pay Discovery Accelerator menus and dashboards
- Purchase to Pay Discovery Accelerator Setup
- Order to Cash Discovery Accelerator menus and dashboards
- Order to Cash Discovery Accelerator Setup
- Basic Connector for AppOne
- SAP Connectors
- Introduction to SAP Connector
- SAP input
- Checking the data in the SAP Connector
- Adding process specific tags to the SAP Connector for AppOne
- Adding process specific Due dates to the SAP Connector for AppOne
- Adding automation estimates to the SAP Connector for AppOne
- Adding attributes to the SAP Connector for AppOne
- Adding activities to the SAP Connector for AppOne
- Adding entities to the SAP Connector for AppOne
- SAP Order to Cash Connector for AppOne
- SAP Purchase to Pay Connector for AppOne
- SAP Connector for Purchase to Pay Discovery Accelerator
- SAP Connector for Order-to-Cash Discovery Accelerator
- Superadmin
- Dashboards and charts
- Tables and table items
- Application integrity
- How to ....
- Working with SQL connectors
- Introduction to SQL connectors
- Setting up a SQL connector
- CData Sync extractions
- Running a SQL connector
- Editing transformations
- Releasing a SQL Connector
- Scheduling data extraction
- Structure of transformations
- Using SQL connectors for released apps
- Generating a cache with scripts
- Setting up a local test environment
- Separate development and production environments
- Useful resources
Example: Creating an R Script
This example explains how to interface the UiPath Process Mining platform with external R scripts to implement external data processing.
Follow these steps to be able to use R-script in the platform.
Step |
Action |
---|---|
1 |
Download the latest version of the R package from https://cran.r-project.org/bin/windows/base/. |
2 |
Install R on the server. Note: this must be the server on which UiPath Process Mining is installed.
|
3 |
Locate the installation directory and find path of Rscript.exe. For example: C:/Apps/Rscript.exe |
R is installed on the server, and developers can connect to it with a connection string.
The installation path is needed to create connection strings for an R script.
Start with some dummy data, to test your workspace setup. For example, use the “Hello World” example as described in Example: Creating a Python Script.
The dummy R script will than contain:
write("Hello world!", stderr()); quit("default", 1)
In this example an R script is created which clusters cases based on their traces.
The generic script datasource requires handlers for all external processes that you want to run.
Follow these steps to add the script handler for R script.
Step |
Action |
---|---|
1 |
Go to the Superadmin Settings tab. |
2 |
Add a field
GenericScriptHandlers with as value an object with one key, “r”, which has as value the path to your python executable. For example:
|
3 |
Click on SAVE. |
In your text editor, start a blank text file and enter the following code.
## get command line arguments
args <- commandArgs(trailingOnly=TRUE)
inputfile <- args[1]
## read csv file
input <- file(inputfile, 'r')
df <- read.table(input, header=TRUE, sep=";")
## pre-processing
df <- table(df)
df <- as.data.frame.matrix(df)
df <- df[, sapply(data.frame(df), function(df) c(length(unique(df)))) > 1] #remove columns with unique value
## cluster
df <- scale(df)
kc <- kmeans(df, centers = 5)
cluster <- kc$cluster
## output
resultdata <- cbind(rownames(df), cluster)
colnames(resultdata)[1] <- 'Case ID'
write.table(resultdata, row.names = FALSE, sep=";", qmethod = "double")
## get command line arguments
args <- commandArgs(trailingOnly=TRUE)
inputfile <- args[1]
## read csv file
input <- file(inputfile, 'r')
df <- read.table(input, header=TRUE, sep=";")
## pre-processing
df <- table(df)
df <- as.data.frame.matrix(df)
df <- df[, sapply(data.frame(df), function(df) c(length(unique(df)))) > 1] #remove columns with unique value
## cluster
df <- scale(df)
kc <- kmeans(df, centers = 5)
cluster <- kc$cluster
## output
resultdata <- cbind(rownames(df), cluster)
colnames(resultdata)[1] <- 'Case ID'
write.table(resultdata, row.names = FALSE, sep=";", qmethod = "double")
Follow the steps below.
Step |
Action |
---|---|
1 |
Save the text file as
script.r .
|
2 |
Upload the
script.r file to your workspace.
|
.CSV
like string. It should be placed in the Globals table since it will serve as input in a table definition.
csvtable
function to define input data.
For this example, we have an application with the an Events table. See illustration below.
R_input_data
from the Globals table to Events.
Step |
Action |
---|---|
1 |
Open the app in your development environment, and go to the Data tab. |
2 |
Select the Globals table. Right-click on the Globals table in the table item list and select New expression…. |
3 |
Set the type to Lookup. |
4 |
Select Events as input table. |
5 |
Enter the following expression:
|
6 |
Enter R_input_data in the name field. |
7 |
Click on OK to save the expression attribute in the Globals table. |
The expression attribute is created in the Globals table. See illustration below.
Next, set up a datasource table in the application which will call the script.
Follow these steps to set up the script data source.
Step |
Action |
---|---|
1 |
In the Data tab, create a new Connection string table. |
2 |
Rename the
New_table to RscriptExample .
|
3 |
Right click on the
RscriptExample table and click Advanced > Options….
|
4 |
In the Table Options dialog, set the Table scope to Workspace. |
5 |
Double click on the
RscriptExample table to open the Edit Connection String Table window.
|
6 |
Enter the following as Connection string: ``'driver={mvscript |
7 |
Enter the following as Query:
See illustration below. |
8 |
Click on OK, and click on YES to reload the data. |
When loading the data, new attributes are detected. Click on YES(2x) and click on OK.
Rscript_example
table now has two datasource attributes, Case_ID and cluster.
See illustration below.