Robotic Process Automation (UiPath)
Detailed Answers for IE1 Paper: 1 Point = 1 Mark
- Locate and Add: Search for the Delay activity in the Activities panel and drag-and-drop it directly between the "Click Submit" and "Click Close" activities within your workflow sequence.
- Access Properties: Click on the newly placed Delay activity and navigate to the Properties panel on the right side of the UiPath Studio interface to locate the Duration field.
- Time Configuration: Input the exact timespan format
00:00:10 (representing Hours:Minutes:Seconds) into the Duration property to instruct the robot to halt all operations for exactly 10 seconds.
- Build the Table: Drag a Build Data Table activity, click "DataTable...", and define the schema: create a String column named 'Student_Name', an Int32 column named 'Roll_No', and a String column named 'Class'. Add random mock data into the rows and save the output to a variable named
dt_Students.
- Set up the Loop: Drag a For Each Row in Data Table activity into the sequence directly below the build step, and provide the
dt_Students variable as the input table to iterate through.
- Extract and Display: Inside the body of the loop, insert a Message Box activity and use the expression
CurrentRow("Student_Name").ToString + " | " + CurrentRow("Roll_No").ToString + " | " + CurrentRow("Class").ToString to extract and display the respective cell values of each iteration.
- Data Extraction: First, use an Assign activity to extract the last character of the student's ID number (using string manipulation like
studentID.Substring(studentID.Length - 1)) and store it in a String variable named lastDigit.
- Configure Switch: Drag a Switch activity into the workflow, ensure its
TypeArgument property is set to String, and place the lastDigit variable into the Expression field.
- Define Cases: Add distinct cases to the Switch block: Case "1" executes an assign/message for "Red House", Case "2" executes for "Blue House", Case "3" executes for "Green House". Finally, configure the built-in Default section to output "Guest House" for any remaining scenarios.
Step-by-Step RPA Logic:
- Create a new Integer variable named
highestSales to keep track of the maximum value found.
- Use an Assign activity to initialize
highestSales to the very first item in the array using the expression: highestSales = SalesArray(0).
- Drag a For Each activity into the workflow to iterate through every element in the collection.
- Configure the For Each loop by providing
SalesArray as the input list and ensuring the TypeArgument is correctly set to Int32 (the item variable can be named currentSale).
- Inside the Body of the For Each loop, drag and drop an If activity to establish a conditional check.
- In the Condition property of the If activity, write the expression:
currentSale > highestSales to compare the current array item against the stored maximum.
- Inside the Then branch of the If activity (which triggers if a new highest number is found), place an Assign activity. Set it to update the variable:
highestSales = currentSale.
- Outside and below the entire For Each loop, add a Write Line activity with the text
highestSales.ToString to print the final highest value to the Studio Output panel.
- Establish Source Context: Use an Attach Browser activity directed at the e-commerce web application to ensure the robot is interacting with the correct active window.
- Data Extraction: Within the browser scope, use a Get Text (or Get Full Text) UI automation activity, utilizing "Indicate on screen" to capture the required order information into a string variable.
- Populate Clipboard: Use the Set To Clipboard activity, passing the extracted string variable as input, to temporarily load the order data into the operating system's native clipboard memory.
- Establish Target Context: Use a second Attach Browser activity to switch the automation focus to the logistics fulfillment portal.
- UI Navigation: Use a Click activity to place the cursor directly inside the specific target input field on the logistics portal.
- Retrieve Clipboard Data: Utilize the Get From Clipboard activity to pull the stored data out of memory and assign it to a new local string variable.
- Data Entry (Pasting): Use a Type Into activity to input the retrieved variable into the portal, OR alternatively, use a Send Hotkey activity configured to send
Ctrl + V to simulate a human paste command.
- Efficiency & Accuracy Justification: This clipboard approach vastly improves efficiency by eliminating manual tab-switching and improves accuracy by completely removing the risk of human transcription errors (typos) during data transfer.
- Variable Initialization: A
While activity requires the developer to manually declare and initialize a counter variable (e.g., Assign counter = 5) prior to the loop. A For Each loop inherently operates on a pre-existing collection without needing a manual starting integer.
- Condition Evaluation: The
While loop dynamically evaluates a Boolean expression (e.g., counter <= 50) at the beginning of every cycle. Conversely, For Each automatically continues until it exhausts all items in the provided array/list.
- Increment Mechanism: Inside a
While loop, the developer must explicitly add an Assign activity to step up the value (counter = counter + 5). A For Each loop automatically increments to the next indexed item in the collection automatically.
- Implementation Complexity (For Each): To achieve this specific 5-to-50 increment task using
For Each, the developer would be forced to artificially generate a static array `[5, 10, 15, 20... 50]` beforehand, which is highly inefficient and rigid.
- Implementation Ease (While): The
While activity requires only a starting number, a limit condition, and a mathematical addition step, making it highly flexible if the increment size or upper limit changes in the future.
- Conclusion/Suitability: The
While activity is structurally vastly superior for this scenario because the termination condition is based on a dynamic mathematical boundary, whereas For Each is strictly designed for iterating over a known, finite list of objects.
Step-by-Step RPA Logic:
- Create Default: Use an Assign activity to securely set a variable (
defaultPass of type SecureString). Expression: (new System.Net.NetworkCredential("", "123456")).SecurePassword.
- Display Default: Use a Message Box activity to display the password by converting it back to a readable string using the expression:
new System.Net.NetworkCredential("", defaultPass).Password.
- Initialize Counter: Use an Assign activity to create an Integer variable named
attemptCount and set its initial value to 0.
- Implement Loop: Drag a Do While (or While) loop container into the workflow to manage the retry logic. Set the condition to allow looping only while
attemptCount < 3.
- Prompt User: Inside the loop, add an Input Dialog activity. Check the "IsPassword" property (so characters type as asterisks) and save the user's input into a SecureString variable named
userPass.
- Compare Strings: Drag an If activity to evaluate the match. Since SecureStrings cannot be directly compared with an "=" operator, convert both to strings in the condition:
new System.Net.NetworkCredential("", userPass).Password = new System.Net.NetworkCredential("", defaultPass).Password.
- Success Path: Inside the Then branch of the If block, place a Message Box displaying "Success!", followed immediately by a Break activity to forcibly exit the loop and grant access.
- Failure Path: Inside the Else branch, place a Message Box displaying "Failure/Try Again", followed by an Assign activity to manually increment the attempt counter:
attemptCount = attemptCount + 1. After 3 failures, the loop terminates naturally.