connect

Connect to SQL Database using UiPath

In this article, we will learn how to query SQL database using UiPath. SQL is used to create, maintain and retrieve the relational database. Process automation with SQL is common use case which involve retrieving data from databases through queries. Let’s understand how to connect and query using UiPath.

We are using AdventureWorks Database in this tutorial. This is Microsoft product sample for an online transaction processing (OLTP) database. The AdventureWorks Database supports a fictitious, multinational manufacturing company called Adventure Works Cycles. You can download it from here.

Prerequisites: You will need to have database activities package installed in UiPath studio. You can install these activities using package manager.

Let’s get started! First activity we need is to create connection. “Connect” activity sets up the connection between UiPath studio and Database. Drag and drop Connect activity on the page. connect Click ‘Configure Connection’ button. connection-setting On Connection settings dialog, click “Connection Wizard” button to select data source. Select ‘Microsoft SQL Server’ from list. After that, select data provider for SQL server from Data provider drop down list. Click OK. provider ‘Connection Properties’ dialog will be opened then Select your database server name from drop down list. Provide authentication details as required. After that,  Select the database you want to connect to. database Click ‘Test Connection’ button to verify that UiPath is able to connect to the database. test-connection
Click OK then click Ok again on ‘Edit Connection Settings’ dialog box. You will be able to see connection string with all the details. Select ‘SQL Client’ from dropdown to specify Provider name. conn-settings These steps create a connection between database and UiPath. You will need to store in a variable of type ‘DatabaseConnection’. Create a variable and assign it to output property of ‘Connect’ activity. We have ‘connAdventureWorks’ variable for this. conn Once we have a connection established, now we can execute queries. Drag and drop ‘Execute Query’ activity from the list. execute-query Click on ‘Configure Connection’ button to open settings. After that, mention connection variable name. Select OK and get back to Execute Query activity. conn-name Click ‘Edit Query’ button and mention the SQL query you want to run. query This query when runs successfully, returns a table. So we need a data table variable to hold these values. prop Then to see how many rows we’ve got in data table, we are writing it to excel file using ‘Write Range’ activity. write-range Below is the list of products from SQL database. output

Conclusion:

Using database activities, we can query SQL database and get results in the data table using ‘Execute Query’ activity. If it’s required to execute INSERT, UPDATE, DELETE queries, we have to use ‘Execute Non Query’ activity in similar way. This activity returns number of rows affected.

Check out our other tutorials here.

Contains

String Manipulations with UiPath

String Manipulations with UiPath is very helpful in RPA projects as RPA developers use String data types more often than not. Data handled with UiPath comes in many types and most often it will be either text, numbers, dates and times, lists or tables. Text is one of the most common data type hence knowing about  Data of all kinds is stored in variables and used in Visual Basic expressions to configure activities. All activity properties have predefined types and expect expression values accordingly. Most of the variables used with UiPath will fit into one of the following categories:

Scalar variables: These will be holding a single value of a fixed type, for example Characters, Booleans, Numbers and DateTimes, Collections like Arrays, Lists and Queues.

Non Scalar variables: Inferring from what we learnt above, non-scalar data is data which is not singular. It is a data structure with multiple data points.

As text is basically a sequence of characters, we may understand String as an extended type of a simple collection. Below are some String Manipulations with UiPath.

Contains:

This function is utilized to check whether the substring happens inside a given string or not. It returns a Boolean value based on occurrence of search text. If search string is found, this method returns True. If no match is found, it returns False.
In example given below, we check if test variable contains the value ‘input’. As this is the valid case, we should see True message. ‘Contains’ function is case-sensitive so if there is any mismatch with case, this function will return false.
Contains

EndsWith

EndsWith function will test the end segment of a String. It checks whether one String ends with the characters in another. If it matches, then it returns True value otherwise it returns false. This function call is case-sensitive so the case should match exactly to have positive value returned.

       In our example, we check if given string starts with ‘Doe’. We have our input as ‘John Doe’. With syntax as given below, we’ll get true value as name starts with ‘Doe’.

EndsWith
StartsWith

StartsWith tests the initial segment of a String. It checks whether one String begins with the characters in another. If it matches, then it returns True value otherwise it returns false. This function call is case-sensitive. 

       In our example, we check if given string starts with ‘Jo’. We have our input as ‘John Doe’. With syntax as given below, we’ll get true value as name starts with ‘Jo’.

StartsWith
 Equals

This function determines whether two strings instances are equal or not. ‘Equals’ is case sensitive hence this function returns true value only if both strings have same value as well as same case.
If values are same but case does not match it will still return false value.
Equals

So those were 4 commonly used String Manipulations with UiPath that we found in this article. . In the following article, we will demonstrate some more string activities that are utilized in RPA projects. I trust this article was valuable and I thank you for review it.

Check out our UiPath Orchestrator Installation Tutorials Below:
http://rpamantra.com/2019/03/10/uipath-orchestrator-installation-2/
http://rpamantra.com/2019/03/10/uipath-orchestrator-installation-part-2/

UiPath Orchestrator Installation- Part 2

Studio Installation/Robot

Select “Entire feature will be installed on local hard drive” from Studio and robot option. Then click next.

SSL Certificate Installation

UiPath needs SSL certificate to be installed on target VM. This is required robot can communicate with Orchestrator. Perform below steps.

  • Try to access Orchestrator URL in browser on target VM. If it is not accessible, please liaise with your network/IT team to get access.
  • It will give error as “security certificate not installed”. Click on it as below:
  • Click View certificate -> Install certificate
  • Select Local machine. click on Next.
  • Install license in “Trusted Root Certificate Authority” as below:
  • Click Finish. It will show message “Import is successful”
  • Refresh orchestrator URL.
  • Run C:\Program Files (x86)\UiPath\Studio\UiRobot.exe. Open UIRobot icon from System Tray.
  • Click on UIRobot settings
  • Mention Orchestrator URL and robot key. Click on connect. It should show “Status: Connected”.

License Activation and Uploading

Please activate Orchestrator by following steps given at below link:

https://orchestrator.uipath.com/docs/activating-and-uploading-your-license

After successful activation you can see expiry date of license after logging in to Orchestrator.

Multi-tenant

UiPath creates “default” tenant. If you want to create new tenant click on “Become A Tenant” button:

UiPath Orchestrator Installation- Part 1

System Requirement

Orchestrator Server

Minimum Recommended
Hardware
CPU 8 X 2.4Ghz cores 16 X 2.4Ghz cores
8GB RAM 16GB RAM
200GB HDD
 
 
300GB SSD
 
 
Windows Server
2008 (R2) SP1 (x86 or x64)
Windows Server 2012 (R2)
(x86 or x64)
Windows Server 2016
Windows Server 2016
IIS
7.5+
7.5+
IIS
7.5+
 
PowerShell 4.0+ PowerShell 4.0+
   
 Software (Also mentioned in pre-requisite
link):
.NET
Framework 4.5.2
.NET
Framework 4.5.2
URL
Rewrite 2.0+
URL
Rewrite 2.0+
Internet
Explorer 11
Internet
Explorer 11 and current Chrome/FireFox
Web
Deploy 3.5+
Web
Deploy 3.5+
SSL
Certificate
SSL
Certificate
Java
v8.181
Java v8.181
Elastic
Search 6.3.2 (Optional)
Elastic
Search 6.3.2 (Optional)
Kibana
6.3.2 (Optional)
Kibana
6.3.2 (Optional)

Database Server

Minimum Recommended
Intel Quad Xeon Processor 8 X 2.4Ghz cores Intel Quad Xeon Processor 16 X 2.4Ghz cores
8GB RAM 32GB RAM
Hard-Disk 250GB Hard-Disk 500GB
Windows Server
2008 (R2) SP1 (x86 or x64)
Windows Server 2012 (R2)
(x86 or x64)
Windows Server 2016
Windows Server 2016
2008 R2 Standard or Enterprise Edition2012 Standard or Enterprise Edition2014 Standard or Enterprise Edition2016 Standard or Enterprise Edition2017 Standard or Enterprise Edition

 

 

2016 Standard or Enterprise Edition 

 

Default SQL
Collation (Latin1_General_CI_AS)
Default SQL
Collation (Latin1_General_CI_AS)
High performance disk array High performance disk array
SQL Server
(2008 R2 Standard or Enterprise Edition/
2012 Standard or Enterprise Edition/
2014 Standard or Enterprise Edition/
2016 Standard or Enterprise Edition/
2017 Standard or Enterprise Edition)
SQL Server
(2008 R2 Standard or Enterprise Edition/
2012 Standard or Enterprise Edition/
2014 Standard or Enterprise Edition/
2016 Standard or Enterprise Edition/
2017 Standard or Enterprise Edition)
SQL Server management Studio SQL Server management Studio

Software
Pre-requisite Installation

Please perform steps given at below link to get all
pre-requisite software’s which are required to be install before Orchestrator
installation:

https://orchestrator.uipath.com/docs/prerequisites-for-installation

Please note, at the step “Add the necessary Server
Roles and Features”:

Sometimes Powershell scripts does not execute and gives error then, go to given link (i.e. https://orchestrator.uipath.com/docs/server-roles-and-features) which will show manual steps of IIS configuration. Perform them instead of Powershell scripts execution.

Orchestrator
Installation

After installing all pre-requisites, please check whether
Database is accessible from Orchestrator server/not. It should be accessible.

Start the set-up.

Accept terms and click on “Advanced” button.

You can see 3 things available installation:

  1. Studio– For
    Development of workflows
  2. Robot
    Execution of bot on target VM where bots are actually going to run (Target VM)
  3. Orchestrator
    Website
    – Monitor and schedule jobs/robots (Orchestrator server)

In order to install only Orchestrator, select “Entire
feature will be installed on local hard drive” from Orchestrator Website option
and select “Entire feature will be unavailable” for others two (Studio, Robot).

Then click next.

Please follow the steps given at below link to install
Orchestrator (Single Node) as given at below link:

https://orchestrator.uipath.com/docs/the-windows-installer

Elastic search and Kibana (Optional)

Elastic search and Kibana are optional. If you want to install them, then download set-up of version mentioned in “Orchestrator Server” table above and use below ELK Guide .pdf for installation steps of only Elastic search and Kibana.

http://rpamantra.com/wp-content/uploads/2019/03/O3-1.pdf

Before installing Elastic Search insert “Path to log files” value as below highlighted
in “elasticsearch.yml” file in “Paths” section:

# Paths

# Path to directory where to store the data (separate
multiple locations by comma):

path.data: C:\ElasticData

# Path to log files:

path.logs: C:\Users\\AppData\Local\UiPath\Logs

Note: Remember to remove # (hash) at the start of that
line as above. # (hash) gets treated as commented code which will not be
considered. Path may differ on your system.

Kibana Configuration

Edit Orchestrator Web.config file for “robotElasticBuffer” section for
highlighted fields as below:

xsi:type=”BufferingWrapper” flushTimeout=”5000″>

<target
xsi:type=”ElasticSearch” name=”robotElastic” uri=”http://MachineName:9200″ index=”UiPath${event-properties:item=indexName}-${date:format=yyyy.MM}”
documentType=”logEvent” includeAllProperties=”true”
layout=”${machinename} ${message}”
excludedProperties=”agentSessionId,tenantId,organizationUnitId,indexName”
/>     

 

Restart the IIS.

It will import Orchestrators logs existing data in Kibana. You can see new index created with “UiPath*” in search.

 

Kibana Dashboard Index Pattern

 

Create Index Pattern