📣 Welcome to Day 4 of the UiPath Studio Web Workshop. In this session, we will focus on sharpening your data manipulation skills in UiPath Studio Web. Join us as we dive into tasks that involve various string operations, including length checks, substring extraction, index manipulation, handling last letters, and executing replace functions.
👉 Topics covered:
📌 Task1: String Manipulations
Assigning a Set of Strings
Performing Length Check, Substring Extraction, Index Manipulation, Handling Last Letters, and Removal Operations
📌 Task2: Word Replacement Magic
Assigning Input Value
Executing Replace Function to Substitute a word with another
Speakers:
Vajrang Billlakurthi, Digital Transformation Leader, Vajrang IT Services Pvt Ltd. and UiPath MVP
Swathi Nelakurthi, Associate Automation Developer, Vajrang IT Services Pvt Ltd
Rahul Goyal, SR. Director, ERP Systems, Ellucian and UiPath MVP
👉 Visit the series page to register to all events.
4. 4
• Overview:
- Brief explanation of string manipulation: String manipulation involves modifying or transforming text data to
achieve specific objectives.
- Importance: String manipulation is fundamental in data processing, text analysis, and automation workflows.
- Key operations: Includes tasks like extracting substrings, converting case (uppercase/lowercase), removing or
replacing characters, and splitting/joining strings.
- Significance in UiPath: String manipulation activities in UiPath enable efficient data processing and manipulation
within automation workflows.
• Demonstrating Operations:
- Index: Find the Index of a character
• Explanation: Index operation helps locate the position of a character or substring within a string. It returns the
index of the first occurrence of the specified character or substring.
• Example Data:
- InputString: "RPA can automate tasks"
- Output: 5
• Expression: InputString.IndexOf(“a")
1. String Manipulation
5. 5
- Substring: Extracts a portion of a string based on its Index position or length.
- Explanation: Substring operation allows you to retrieve a specific portion of a string. It takes two
parameters: the starting index and the length of the substring to extract.
• Example: Extract the substring "world" from the input string "Hello world!" by starting at index 6 and
extracting 5 characters.
- InputString: "Hello world!“
- Output: "world“
- Expression: InputString.Substring(6, 5)
- Substring from a Particular Word:
• This prompt extracts a substring from the text stored in the variable InputString, starting from the
word “tool" and including the rest of the text following it. It utilizes the IndexOf method to find the
starting position of “tool" and then extracts the substring using the Substring method.
• Example: Substring from the word ‘tool’
- InputString: “UiPath is one of the tool of RPA”
- Ouput: “tool of RPA”
- Expression: InputString.Substring(InputString.IndexOf(“tool"))
6. 6
- Capitalize the first letter of each word in <[InputString]>
• Explanation: This task capitalizes the first letter of each word in a given input string.
• Example Data:
- InputString: "hello world"
- Output: "Hello World“
- Expression: System.Globalization.CultureInfo.CurrentCulture.TextInfo.ToTitleCase(InputString.ToString())
- Check <[InputString]> is palindrome
• Explanation: This task checks whether the input string is a palindrome, meaning it reads the same
forwards and backwards.
• Example Data:
- InputString: "radar"
- Output: "True“
- Expression: InputString = New String(InputString.Reverse().ToArray())
7. 7
- Extract the first name from <[InputString]>
• Explanation: This task involves extracting the first name from a given input string.
• Example Data:
- InputString: "John Doe"
- Output: "John"
- Expression: InputString.ToString().Split(" "c)(0)
- New string from <[InputString]> by removing vowels
• Explanation: This task creates a new string from the input string by removing all vowels.
• Example Data:
- InputString: "This is a sample input string containing vowels.“
- Output: "Ths s smpl npt strng cntnng vwls.“
- Expression: New String(InputString.Where(Function(c) Not "AEIOUaeiou".Contains(c)).ToArray())’’
8. 8
- Reverse the order of words in a sentence
• Explanation: This task reverses the order of words in a given sentence.
• Example Data:
- InputString: "This is a sample sentence"
- Output: "sentence sample a is This"
- Expression: String.Join(" ", InputString.Split(" ").Reverse())
- Reverse a String:
• Explanation: This task reverses the characters in the string. It uses the Reverse method to reverse the
characters and then concatenates them back into a single string.
• Example Data:
- InputString: "John Doe“
- Output: "eoD nhoJ".
- Expression: String.Concat(Inputstring.Reverse())
9. 9
• Overview:
- This UiPath automation project focuses on segregating data from a spreadsheet into different sheets
based on the department.
- The data is read from the spreadsheet using the Read Range activity.
- Distinct department values are obtained using String Manipulation.
- Data is filtered department-wise and written to corresponding sheets.
• Variables:
- Read range: Auto-generated variable holding the entire spreadsheet data.
- DistinctDepartments: Variable that holds the list of unique departments
- CurrentItem: Auto-generated variable holding each department name in the list, renamed as
CurrentDepartment.
- Filtered Data Table - Auto-generated variable holding the department-based row data.
- Sheet Name- Auto-generated variable containing the added sheet information.
2. Data Segregation by Department
10. 10
• Read Spreadsheet Data:
- Use Read Range activity to read entire spreadsheet data.
• Read range: Auto-generated variable holding the entire spreadsheet data.
• Get Distinct Department Values:
- Unique departments allow us to filter the data accurately. When we're separating data for each department,
we need to ensure that we're only including information relevant to that specific department. By identifying
unique departments beforehand, we can create a clear and distinct separation between different sets of
data.
- Once we have unique departments, we can create individual spaces or sheets for each department in the
spreadsheet. This helps maintain organization and clarity within the document. Each department gets its
own designated area, making it easier for users to locate and work with the data related to their department
without interference from other departments' data.
- In summary, obtaining unique departments in our process ensures that we can effectively filter and
segregate the data, as well as create organized spaces for each department's information within the
spreadsheet. This promotes efficiency and clarity in data management and analysis.
Workflow Overview
11. 11
- Use Set Variable activity and create a variable named DistinctDepartments to hold list of the
unique departments
- Provide the expression to retrieve distinct department values as described:
• readRange.AsEnumerable().Select(Function(row) row.Field(Of
String)("Department")).Distinct().ToList()
• Iterate Through Each Department:
- Use For Each activity to iterate through each department in the DistinctDepartments list.
• DistinctDepartments: List of distinct departments.
• CurrentItem: Auto-generated variable to hold each department name. Rename it to
CurrentDeparment.
• Filter Data by Department:
- Use Filter DataTable activity to filter data based on the current department.
• Filter Condition: Choose Read Range > Show more > Read range > Columns and select the
DepartmentColumn in field1 and choose ‘=‘ in filed2 and provide CurrentDepartment variable in
field3. (readRange.Columns.DepartmentColumn = CurrentDepartment)
• Actions: Choose "keep matching elements only".
• Filtered Data Table: Auto-generated variable holding the department-based row data.
12. 12
• Add Sheets for Each Department:
- Use Add Sheet activity to add sheets for each department.
• Sheet name: Provide CurrentDepartment as the sheet name.
• Sheet Name variable is auto-generated, containing the added sheet information.
• Write Filtered Data to Corresponding Sheets:
- Use Write Range activity to write the department-based filtered data to their corresponding sheets.
• Range: Use the Sheet Name Variable to determine the destination sheet
• What to write: Provide Filtered Data Table variable as the input.
• Note: Ensure that the department names match exactly with the department names in the
spreadsheet to ensure accurate segregation.