...
  • March 31, 2022
  • Rohit Kashyap
  • 0

Data Manipulation in UiPath

Data Manipulation includes dealing withvarious variables and performing operations with them. UiPath Studio offers a wide range of variables to support automation: –

  • Text variables: – This type of variable can store only string data type and is enclosed in double quotes. You can define the type as “System.String” to declare this kind of variable.
system string
  • True or False variables: – This type of variable stores only two possible values – true or false and supports Boolean data type. You can define the types as “System.Boolean” to declare this kind of variable. Make use of this data type when working with flow decisions in Studio.
True or false variables

Number variables: – This type of variable stores numeric data and supports Integer values. You can define the type as “Int32” to declare this kind of variable. Use the “.ToString” method to convert the integer variable to a string and display as such.

Number variables
Array variables

To access all the values you store in an array, give a reference of index in the output. For example, to retrieve the first name from the arrStrnames variable, write line as arrStrNames(0)

Arrstrnames

List variables: – This type of variable will allow you to store a varying number of multiple values of the same data type. For example, you can declare a list of strings as – System.Collections.Generic.List

List variables
  • Dictionary variables: – A dictionary is an array which can hold a varying number of elements associated with a key-value format. The value is retrieved from the defined key in the variable. To declare a dictionary variable, use “System.Collections. Generic.Dictionary” as the data type.
Dictionary variables
  • Date and Time variables: – This type of variable stores information about any date and time. Declaration is done by using “System.DateTime” as the data type. The default format used is “day.hh:mm:ss”. You can modify the format to only retrieve a particular component.
  • Data table variables: – This variable can store information in a database or a simple spreadsheet consisting of rows and columns. Declare this kind of variable by using “System.Data.DataTable”. You can make use of this variable when dealing with excel/workbook automation.
  • Generic-Value variables: – This variable can store any kind of data such as numbers, text, dates, arrays, etc. Use this data type when unsure of the exact structure of data you are dealing with. Declare using “UiPath.Core.GenericValue” data type.

String Manipulation in UiPath

UiPath offers a wide range of functions that can be used to perform operations on strings. Details to each are as below:

  • Split: This function will divide the string into two parts based on the split identifier mentioned. For an example, take a string “str” as “My:name:is” and define the slit function as – “Split(str,”:”). This will split the string in three different sections based on “:” and to retrieve any one section, you can refer to the output by an index as done in an array.
split
  • Substring: This function lets you customize your division of the entire string.
Sub string
  • Trim: This function removes the leading spaces (Ltrim), trailing spaces(RTrim) or leading and trailing spaces (Trim) from a string. Use this function as – Trim(yourstring), LTrim(yourstring), RTrim(yourstring).
  • Replace: This function allows you to replace a character with another character specified. Here “:” gets replaced with “_”
replace

Remove: This function removes the text specified. It can be understood as an inverse operation to substring.

Remove

• Left: This function outputs the text from the left side of the variable value.

left
  • Right: This function outputs the text from the right side of the variable value.
Right
  • Regex.Replace: This function will replace an expression combination according to the regex specified with a character. Here, “d” is used as a regular expression to find digit combinations only and then they are replaced by an underscore “_”.
Regex Replace

Tags:

Leave a Reply

Your email address will not be published. Required fields are marked *