Uipath Guide PDF

Download as pdf or txt
Download as pdf or txt
You are on page 1of 6

UIPath Guide PDF

1). How to get name of process:

Ans:- System.Diagnostics.Process.GetProcessesByName("Chrome")

2).To Get total number of processes

Ans:- System.Diagnostics.Process.GetProcessesByName("EXCEL").Count > 0

3). How to select specific rows from a Data Table

Ans:- Method 1 - When there is no space in column name

Array_1 = ExtractDataTable.Select("Type = 'WI5' and Status = 'Open'")

Type and Status are columns of DT and it returns the output in form of an array not DT.

Method 2 - for spaces in the column name

dt.Select("[Blood Group] = 'B-ve' AND [Age] > 50 AND ([City] ='Hyderabad' OR [City] ='Pune' )
").CopyToDataTable

4). When you publish your package, you need to update it in Process section in Orchestrator. Only then
its available for use in all robots.

5). Default type into- Just types it like a human being by opening a window

Simulate Type into - It just removes formatting from text and types everything in one line

Windowed

6). How to find #Common and #Uncommon values between two #Lists?

Ans:- Try this...

#Common

List<int> one = new List<int>() {1, 3, 4, 6, 7};

List<int> second = new List<int>() {1, 2, 4, 5};

foreach(int r in one.Intersect(second))

#Uncommon

int[] one = new int[] { 1, 2, 3, 4 };


int[] second = new int[] { 2, 3, 5, 6 };

foreach(int r in one.Except(second))

or

foreach(int r in second.Except(one))

7). How to get outlook mail via mail address

Ans:- "[senderemailaddress][email protected]"

To get outlook mail via user name

"[FROM]=‘Miller"

8). How to get count of a specific repeating words.

Ans:- Repetition_count_Double = (Output_String.Length –

Output_String.Replace("Outlook","").Length) / "Outlook".Length

explanation - "aa bb cc dd aa ff"

Output_String.Length = 12

Output_String.Replace("aa","").Length = 8

subtraction = 4

dividing by actual "aa".length = 4/2 = 2

2 is number of times "aa" is in string.

9). How to get data from a list when select one is not working

Ans:- 1) Use Get Attribute Activity and get the "items" attribute of the dropdown list.

2) Output will be a Array

3) Just search the Array, if array item contains "Corporation - 157075" then use that in select
item Activity

10). Use Convert.ToByte(Str) to convert any string or char to bytes

Ans:- eg Convert.ToByte("A"c)

o/p = 65

11). To Split Text use below


Ans:- -Text1.Split ({"\n",system.Environment.NewLine },StringSplitOptions .None ) -- new line split.

-Conf_id.ToString.Split(" "c) -- character Split

-Clientinfo.Split({"Client ID: ","Client Name: ","Client Country: "},StringSplitOptions.None) --


Multiple Split

-Clientinfo.Split("Client ID: ",StringSplitOptions.None) -- Single

12). How to get the file list in a directory

Ans:- Directory.GetFiles(“address”)

Directory.GetDirectories("InvoiceDemo\Invoice files", "*", SearchOption.AllDirectories).Count()

13). How to color a specific cell in excel

Ans:- a. To get actual row index of the cells to be colored :- Assign StrIndex =
(dtTable1.Rows.IndexOf(row)+2).ToString

b. Use SET RANGE COLOR activity.

c. In Properties :- Color - System.Drawing.Color.Yellow

Range - "A"+strIndex+":C"+strIndex

14). How to check if a string is empty or not-

Ans:- NOT String.IsNullOrEmpty(row("Name").ToString.Trim)

above will return true or false

15). UiPath robot save execution files here. Same is when we execute process via orchestrator.

Ans:- 'C:\Users\ibindra\.nuget\packages'

16). How to convert DataTable to DataRow in raw format.

'Assign - Datarow = DataTable.Select()'

17). NewtonSoft json conversion


18).how to compare strings in uipath:

Ans:- row.Item(3).ToString.Equals("")

DataRow rows = DataTable.Select("[COLUMN 1]='' OR [COLUMN 2]=''");

19). To get unique rows from a DT to another DT:

Ans:- Assign - dtYourDataTable = dtYourDataTable.AsEnumerable.GroupBy(Function (drRows)


drRows.Item("User")).Select(Function (drGroupedRows) drGroupedRows.First).CopyToDataTable

20). To match 2 data rows.

Ans:- Convert the entire data rows (of both excel) to HASH (By joining the itemArr via String.Join
function and apply the Hash activity.) and compare hashes

21). To take screenshot -

Ans:- a. Use take screenshot activity. (UiPath.core.Image - Variable Type)

b. Use save image

22). Convert Regex Match{} to Collections.List{}

Ans:- list_string = match_ienumerable_result.AsQueryable.select(function(x) x.value).tolist

23). How to convert System.Security.SecureString to String

Ans:- String_Variable = new System.Net.NetworkCredential(string.Empty,secure).Password

To convert String to secure SString

SecureString_Varuable = new NetworkCredential("", "myPass").SecurePassword;

24). How to cast values.

Ans:- New_String = CType(var, String)

DirectCast(var, String) is used to up-cast an object into a string. If you know that an object variable
is, in fact, a string, use this. This is the same as (string)var in C#

25). To get value from QueueItem


Ans:- CashIn = in_TransactionItem.SpecificContent("CashIn").ToString

26). To get excel workbook sheets or any excel related detail

Ans:- a. Define a variable in Excel Application's output (eg Myworkbook)

b. Use the variable to get sheets (eg Myworkbook.getsheets)

27). To create a new folder path - use this. This is helpful, because you don’t need to worry about the
ending slash mark. Secondly, use either Now or Today as your current DateTime so simplify things a bit

Ans:- System.IO.Path.Combine(folderPath, Today.ToString("MM-dd-yyyy")

28). To add a default value to dictionary

Ans:- dict = new Dictionary(of string,string) from {{"Key","Value"}}

29). How to convert to int32

Ans:- integer = Convert.ToInt32(value)

30). How to solve Newton soft issue

Ans:- C:\Users\ibindra\.nuget\packages\newtonsoft.json

31). To upload entire row on queue -

Ans:- 1. For each row, addd row to a custom data table using - Invoke method and invoking -
'ImportRow' method

2. Use this to upload DT as object (place this in item information property of AddQueueItem activity)

Newtonsoft.Json.JsonConvert.SerializeObject(SingleRowDT)

3. Then get the queue item and use Deserialize JSON activity with DataTable setup.

31). To compare 2 array directly:

Ans:- MasterCOllection.Intersect(DupCollection).Any()

32). To use String format like python -

Ans:- String.Format("C:\Users\{0}\AppData\Local\Programs\Python\Python36-32",uname)

33). To accept dictionary from python code

Ans:- Figured it out:

1. In your python code return a json object as

return json.dumps(dict_output)

2. Then here in Get Python Object accept a string,


3. Use Deserialize JSON activity to convert string to dictionary

34). How to particular column as a list

Ans:- (From row in temp_DT.AsEnumerable() Select Convert.Tostring(row(0))).ToList()

35). How to get current directory:

Ans:-1. Get Environment Variable Activity

2. Type - "CurrentDirectory" in it

36). How to get a filtered datatable as per an array

Ans:- (From row In outputdt.AsEnumerable() Join value In arr_var On row.Field(Of String)("COl1")


Equals value Select row).CopyToDataTable

37). To remove element(s) from an array with a single line of code:

Ans:- arr_2 = arr_1.Except(new String() {"a"}).ToArray

38). How to Deep Copy of Dictionary:

Ans:- new Dictionary(of key_type,value_type) (old_dict)

39). Remove Blank Rows from a DT

Ans:- Dt=dt.select("columnname <> ''"). CopyToDataTable()

40). Using Regex to replace stuff

Ans:- System.Text.RegularExpressions.Regex.Replace((dict_LineDetails(item)(0).toString.Trim),
"\s+","").ToString

41). If Statement in Assign Activity:

Ans:- If(Name = "Ishmeet", "Ishmeet",

If(Name = "Jasleen", "Jasleen", "No"))

You might also like