UI Path - Data Manipulation

¡Supera tus tareas y exámenes ahora con Quizwiz!

Contains

Checks whether a specified substring occurs within a string. Returns true or false Expression: VarName.Contains ("text")

Clear Collection

Clears a specified collection of all items. One possible use is to empty a collection before starting a new phase of a process that will populate it again.

concat

Concat Concatenates the string representations of two specified objects Expression: String.Concat (VarName1, VarName2)

Join

Concatenates the elements in a collection and displays them as String Expression: String.Join("|", CollVarName1)

Format

Converts the value of objects to strings (and inserts them into another text) Expression: String.Format("{0} is {1}", VarName1, VarName2)

What is Data manipulation?

Data manipulation is the process of modifying, structuring, formatting, or sorting through data in order to facilitate its usage and increase its management capabilities.

String.Join Example

String.Join(",",AllCitiesProperCase) AllCitiesProperCase is a list

UI Path methods applicable to collection

1. Add to Collection 2. Remove from Collection 3. Exists in Collection 4. Clear Collection

What are most frequently used String Methods?

1. Concat 2. Contains 3. Format 4. Indexof 5. Join 6. Replace 7. Split 8. Substring

Split

Splits a string into substrings using a given separator Expression: VarName.Split("|"c)(index)

What are the methods for Dictionaries

1. Initialization 2. Adding VarName.Add(Key, Value) - adds an item to an existing Dictionary. Because Add does not return a value, use the Invoke Code activity. 3. Removing VarName.Remove(Key) - removes an item from the Dictionary. It can be used in an 'Assign' activity. 4. Retrieving VarName.Item(Key) - returns the Dictionary item by its key VarName.Count - returns an Int32 value of the number of Dictionary items VarName.ContainsKey(Key) - checks if the item with the given key exists in the Dictionary and returns a Boolean result VarName.TryGetValue(Key, Value) - checks if an item with a given key exists in the Dictionary and returns a Boolean result and the value if found

What are the methods used in Regular Expression?

1. Matches Searches an input string for all occurrences and returns all the successful matches. 2. IsMatch Indicates whether the specified regular expression finds a match in the specified input string. 3. Replace Replaces strings that match a regular expression pattern with a specified replacement string.

Add to Collection

Adds an item to a specified collection. It is equivalent to List.Add(). It can be used, for example, to add a new name to a list of company names

Dictionaries?

Dictionaries (or Dictionary<TKey, TValue>, as you will encounter them) are collections of (key, value) pairs, in which the keys are unique. Think of the Address Book in your mobile phone, where each name has corresponding data (phone number(s), email). The data types for both keys and values have to be chosen when the variable is instantiated. Data types in Dictionaries can be any of the supported variables (including Dictionaries, for example). The operations that are most often associated with Dictionaries are: Adding and deleting (key, value) pairs Retrieving the value associated with a key Re-assigning new values to existing keys

What is enumerable

Enumerable is an interface defining a single method GetEnumerator() that returns an IEnumerator interface. It is the base interface for all non-generic collections that can be enumerated. This works for read-only access to a collection that implements that IEnumerable can be used with a foreach statement. The enumerable attribute determines whether or not a property is accessible when the object's properties are enumerated using the for...in loop or Object.keys() method. property is enumerable if it has the enumerable attribute sets to true. The obj.propertyIsEnumerable() determines whether or not a property is enumerable. A property created via a simple assignment or a property initializer is enumerable.

Merging lists example?

Enumerable.Concat(SpainCities.AsEnumerable,UKCities.AsEnumerable).ToList

Substring

Extracts a substring from a string using the starting index and the length Expression: VarName1.Substring(startIndex, length)

Exists in collection

Indicates whether a given item is present in a given collection by outputting a Boolean as the result. We can use this activity to check whether a list of clients contains a specific name.

Invoke Sort Method?

Invoke sort method can be used to sort a collection.

Lists? What are they?

Lists (or List<T>, as you will encounter them) are data structures consisting of objects of the same data type (for example string or integer). Each object has a fixed position in the list; thus, it can be accessed by index. While arrays are fixed-size structures for storing multiple objects, lists allow us to add, insert and remove items.

What is Regular Expression?

Regular Expression (REGEX, or regexp) is a specific search pattern that can be used to easily match, locate and manage text. However, creating RegEx expressions may be challenging. UiPath Studio contains a RegEx builder that simplifies the creation of regular expressions. Typical uses of RegEx include: Input validation String parsing Data scraping String manipulation

Remove from collection

Removes an item from a specified collection and can output a Boolean variable that confirms the success of the removal operation. This activity can be used, for example, to remove an invoice number from a list of invoices to be processed.

Replace

Replaces all the occurrences of a substring in a string Expression: VarName.Replace ("original", "replaced")

Indexof

Returns the zero-based index of the first occurrence of a character in a String Expression: VarName1.IndexOf("a")

String convert function usage

StrConv(item, VbStrConv.ProperCase) can be used to convert item to a proper case

Create list of stores

We created a new List variable ("bookstores") and used a succession of String methods to assign the bookstores from the query: message.Split("."c)(1).ToString.Split(":"c).Last.ToString.Split(","c).ToList

displaying author name and stores list "Availability for x: bookstore1; <newline> bookstore2; <newline> bookstore 3."

We created a new String variable to display the values of the 2 variables: String.Format("Availability for {0}: {1}", author ,String.Join(";"+vbCr,bookstores)). In this expression, String.Join is used to extract each element in the "bookstores" List variable and display them. vbCr is used to go on a new row for each element (similar to Environment.NewLine)

message = "You searched for author Mark Twain. His books can be found in the following stores: Bookland,Classics bookstore." Extraction of Author Name for above string?

v Split("."c).First.ToString extracts the first sentence of the String and converts it to a String; v Substring(message.LastIndexOf("author")) extracts the Substring that is after "author"


Conjuntos de estudio relacionados

chapter 1 uppers, downers, all arounders

View Set

Real Estate Exam - created by JG

View Set

11. Texas Statutes and Rules Pertinent to Life Insurance Only

View Set

𝙀𝙑𝙀𝙍𝙔𝙈𝘼𝙉: VIRTUES (670-787)

View Set