Chapter - 5 Data Elements

25 minutes
Share the link to this page
Copied
  Completed
You need to have access to the item to view this lesson.
One-time Fee
$99.99
List Price:  $139.99
You save:  $40
€95.86
List Price:  €134.21
You save:  €38.35
£79.54
List Price:  £111.35
You save:  £31.81
CA$143.56
List Price:  CA$200.99
You save:  CA$57.43
A$159.95
List Price:  A$223.94
You save:  A$63.98
S$135.54
List Price:  S$189.77
You save:  S$54.22
HK$777.41
List Price:  HK$1,088.41
You save:  HK$310.99
CHF 89.37
List Price:  CHF 125.13
You save:  CHF 35.75
NOK kr1,131.89
List Price:  NOK kr1,584.70
You save:  NOK kr452.80
DKK kr715.08
List Price:  DKK kr1,001.15
You save:  DKK kr286.06
NZ$176.78
List Price:  NZ$247.50
You save:  NZ$70.72
د.إ367.26
List Price:  د.إ514.18
You save:  د.إ146.92
৳11,900.85
List Price:  ৳16,661.67
You save:  ৳4,760.81
₹8,494.03
List Price:  ₹11,891.98
You save:  ₹3,397.95
RM450.75
List Price:  RM631.07
You save:  RM180.32
₦154,505.46
List Price:  ₦216,313.83
You save:  ₦61,808.36
₨27,720.51
List Price:  ₨38,809.83
You save:  ₨11,089.31
฿3,419.79
List Price:  ฿4,787.84
You save:  ฿1,368.05
₺3,506.82
List Price:  ₺4,909.70
You save:  ₺1,402.87
B$608.53
List Price:  B$851.97
You save:  B$243.44
R1,831.63
List Price:  R2,564.36
You save:  R732.72
Лв187.37
List Price:  Лв262.33
You save:  Лв74.95
₩144,627.53
List Price:  ₩202,484.33
You save:  ₩57,856.80
₪363.83
List Price:  ₪509.39
You save:  ₪145.55
₱5,882.91
List Price:  ₱8,236.31
You save:  ₱2,353.40
¥15,642.93
List Price:  ¥21,900.73
You save:  ¥6,257.80
MX$2,007.92
List Price:  MX$2,811.18
You save:  MX$803.25
QR363.05
List Price:  QR508.28
You save:  QR145.23
P1,376.48
List Price:  P1,927.13
You save:  P550.64
KSh12,857.29
List Price:  KSh18,000.72
You save:  KSh5,143.43
E£5,087.81
List Price:  E£7,123.14
You save:  E£2,035.32
ብር12,414.52
List Price:  ብር17,380.83
You save:  ብር4,966.30
Kz91,790.82
List Price:  Kz128,510.82
You save:  Kz36,720
CLP$98,780.55
List Price:  CLP$138,296.72
You save:  CLP$39,516.17
CN¥729.56
List Price:  CN¥1,021.42
You save:  CN¥291.85
RD$6,064.47
List Price:  RD$8,490.50
You save:  RD$2,426.03
DA13,486.35
List Price:  DA18,881.43
You save:  DA5,395.08
FJ$231.62
List Price:  FJ$324.28
You save:  FJ$92.66
Q767.35
List Price:  Q1,074.32
You save:  Q306.97
GY$20,835.60
List Price:  GY$29,170.68
You save:  GY$8,335.07
ISK kr13,848.23
List Price:  ISK kr19,388.08
You save:  ISK kr5,539.84
DH1,002.31
List Price:  DH1,403.28
You save:  DH400.96
L1,836.70
List Price:  L2,571.46
You save:  L734.75
ден5,897.23
List Price:  ден8,256.37
You save:  ден2,359.13
MOP$797.27
List Price:  MOP$1,116.21
You save:  MOP$318.94
N$1,833.49
List Price:  N$2,566.96
You save:  N$733.47
C$3,664.75
List Price:  C$5,130.79
You save:  C$1,466.04
रु13,546.73
List Price:  रु18,965.97
You save:  रु5,419.23
S/370.84
List Price:  S/519.19
You save:  S/148.35
K403.85
List Price:  K565.40
You save:  K161.55
SAR375.59
List Price:  SAR525.84
You save:  SAR150.25
ZK2,756.13
List Price:  ZK3,858.69
You save:  ZK1,102.56
L477.10
List Price:  L667.96
You save:  L190.86
Kč2,408.98
List Price:  Kč3,372.68
You save:  Kč963.69
Ft39,690.03
List Price:  Ft55,567.63
You save:  Ft15,877.60
SEK kr1,103.14
List Price:  SEK kr1,544.45
You save:  SEK kr441.30
ARS$101,779.64
List Price:  ARS$142,495.57
You save:  ARS$40,715.92
Bs688.19
List Price:  Bs963.50
You save:  Bs275.30
COP$435,927.07
List Price:  COP$610,315.34
You save:  COP$174,388.27
₡50,246.58
List Price:  ₡70,347.23
You save:  ₡20,100.64
L2,528.04
List Price:  L3,539.36
You save:  L1,011.31
₲776,552.46
List Price:  ₲1,087,204.52
You save:  ₲310,652.05
$U4,441.97
List Price:  $U6,218.94
You save:  $U1,776.96
zł408.81
List Price:  zł572.35
You save:  zł163.54
Already have an account? Log In

Transcript

Chapter Four, data variables and types. In this chapter, we'll give an overview of what data variables and types are. We'll go through primitive data types. We'll also define what variable scope is. And we'll also talk about arguments and importing namespaces. Over overview of data variables, just like other software programming languages, variables are used in UiPath.

For automations. Variables are entities or data items that can store some value within them. This value can be changed, or you know can be displayed are performed computations upon depending on the business logic that you're implementing. Variable simply refers to the name given to a memory location, which is processed and retrieved during execution of a workflow as per its users needs. So, in here we have provided a few variables like the ones that are shown in here you can see data types, each data type has been assigned a variable right. So, this type defines the nature of value, a variable is permissible to hold.

Various types of data are supported in UiPath, like you know integers, strings, date times, Boolean values, etc, etc. Default, default value as the name itself suggests, is a value which is assigned to a variable as soon as it is created. Right and this is set in here. scope. A data scope simply defines the boundary of a variable where it can be accessed by the activities and computers further. Beyond that scope, that variable is invisible for activities.

So, in UiPath, you know, we define the scope when we are creating the variable itself. A quick example would be, say this integer variable has a scope of flowchart, which means the whole flowchart or any activities within the flowchart can actually see this variable. But imagine we have a sequence, right. And this integer variable has a scope of sequence. That means, only within the sequence we can access this integer variable and outside it, we this integer variable becomes invisible. We can't see it anymore.

So, this is for production of the data items. If there's some data that is critical to one particular sequence or one particular part of a workflow itself, then that's where the scope is used. primitive data types there are like, literally hundreds or probably thousands of dead types that are supported in UiPath. And you can see that in here, browse for types. Because UiPath is based on dotnet programming framework. So all the data types are supported in here, all the dotnet data types.

But we have about six or seven primitive data types that usually accomplish most of the tasks that we're trying to automate or like are used within the those tasks. So integer datatype is first, right. Let me create the variable because I just put it to flowchart just because I'm keeping it as a global variable as it is available to the whole flowchart itself. So indeed, your variable, right, it is, as the name itself tells you, this data type is used to store numeric values and both Positive and negative integers are supported within this within this data type. And it ranges from like 2,147,000,000 something something value from negative to positive both. So a lot of values or pretty much any value is supported in detail variables.

A quick example would be, say in this integer variable, we already have assigned a value of 62 as default, so what we can do is if you want to print the value of this variable in a, you know, no ms window right window should pop up. Once we execute the program displaying the value of this integer variable, then we can use this messagebox activity and we can type in our variable name. Once we start typing the name, right, you can see that automatically the UiPath gave the drop down that said that, you know, are you talking about this variable? And yes, you can select it that way it becomes handy too. Use the variables within the activities. Now, there is some sort of compiler error in here.

And to give an overview of this, it says that there is some con conversion that it's trying to do between integer and string it cannot, the system cannot itself do the because to make a message displayable it has to be of string datatype. So, what we're going to do is via use a dot operator and we are going to change this to string which is again a predefined function in dotnet as well as in UiPath. So, once you have that as to string, you can go to your main program, you will simply run it and see that the value of the first of the variable 62 is being displayed. Perfect. Similarly, we have string data type, as we discussed just now is used to store you know multiple alphanumeric characters and one thing to know In string variables is that the value of a string variable is always enclosed in double quotes.

That's because imagine that you know, you have a value of 62, right? Being an integer, the UI path doesn't need to just store a value, it also probably need to perform some computations on it, right? And string has different operations that can be performed on it, like concatenation splitting a string and stuff. And for integers, we would want to do some algorithmic algorithmic operators, like, you know, addition, subtraction, multiplication, division and all that stuff. So to differentiate between the two string is always enclosed in double quotes, to say that it is sort of a message, right? That's how we do in the message box as well.

If you want to just print you know, welcome or something. Instead of putting it in a variable, you can just put it in double quotes and the message will be displayed, but to display the value of a string message We have to use the string variable name. And that's all we have to do we don't have to use to string because it is already a string type variable right and it will display the message 62 or in our previous case like UiPath Okay, next date time. So, date time variable or date time data type is going to store values corresponding to some date time information right. Again in here, we have used a function of predefined function that is available by dotnet called now function. What now function does is it takes out the current date and time from the from the system that the operation is being performed on.

And we get that data right away in this variable date time variable. So, to print that value to see what the current date time is, there could be a use case for us. We simply use date time variable and again Good, none of us change it to string. So if you want to run this, you can see the current date time on which system is running, that's this date and this particular time. Okay, so the next is going to be a boolean data type. So what boolean data type is it's gonna hold either true or false value.

So these are usually used as flag variables, the variables of boolean data type. So what's a flag variable? a flag variable is like, you know, there are, there is a chance that you want to test a condition and if the condition holds true, you want to go in a certain direction in your workflow. And if it is false, you want to go in another direction. A quick example would be let's say if you are accessing a website, and you take some data from an element in on that website and you want to say, if this if this element is equal to welcome, then if the text corresponding to this element is Welcome, that means I am welcomed in this website. And yes, I want to go further.

And if no, if the value is false if it doesn't match with welcome string, then you can say that you know, no, I'm in the correct incorrect I'm on an incorrect website or something like that. So, the true or false condition is usually usually taken care of by the Boolean variables. And what you can see is once when you'll be assigning a value to a variable, right to Boolean variable, once you write true, it appears in blue color, which means it is a predefined term. It's a predefined terminology, you cannot use a variable called true because it's a value that can be stored or space specific to Boolean variables as well. And in our last chapter as well, we went to continue on error property if you remember, we walked through it and we can set true or false condition. So that means continue on error property, we can say is Type, right.

Okay, next is generic data type. So, Jen data type is something that is a data type that is very specific to you to and can store any kind of data in it, such as text, numbers, date, arrays, etc. When we use any operations within our workflow on these generic data type variables UiPath, automatically converts these variables into the required type and performs the computation. So a quick example would be, let's say in this generic value variable, we have given a value of 75. Right? And now, we want to perform a computation that says that you know, I want to print the addition of integer variable and generic variable.

Okay? So although it's a generic variable, you can see See that the value that you get is 137, which is actually the sum of the two numbers. So it was entered number but UiPath automatically did the implicit conscious conversion of data type, from generic to integer, perform the computation and give give us a perfect result. However, that's not always going to be the case. There is a possibility that you know, because it's, it's an automated system, right? This implicit Canvas conversion, so you cannot totally rely on it.

If If you know that you know, the element that we'll be working off working on is going to be stored in data type. Always use that data type and generic data type should be our last resort. Okay, next is the array data type. So, an array is simply a get like type data items allocated continuously in a memory. So what happens is then area can be created in for any data type, first and foremost. And it's going to be under the same name, let's say airy, the name of an array data type is let's say a.

And it has it can hold, let's say any values, but it has to have a finite number, let's say five. So as you know, and this is of integer datatype, the areas of integer data type, and what it's going to have is at a zero location, this zero location is also called index. So it's your location let's we have a number of five and then at a one location, we have a value of three. So what happens is there is a continuous allocation of same or like type of data items, collectively put under a single name. Right. So what happens is in this array variable, we have used, the variable name is area underscore variable, it's of integer type, and we put we started the curly braces and we gave three values.

That means the length of this error error variable is three. The first element of this is 12, second element is 14, third element of this variable is 90, right? That's how the value has been allocated to it. And if you want to print the, if you print want to print the value of the first element, right, so because the index This is called the index part of the array, so an index always starts with zero for an array, so the zero position of this array variable is going to be the numeric 12. Right, if as you can see, we didn't convert it to string yet. So once we print this, this is going to display the first value of that 12.

If you want to print the second value, simply print one and there you go, the 14 which is the second value of this area. So that's how array is stored in the memory location and is retrieved as well through the index. So array in general has like two different parts. One is called the data value, which we already printed, and the index which defines the location where an element within the array would be present. All right. Other than these, we have another data type called list.

Right. So what list is, it's pretty much same as array. The only difference is that area has a fixed length, while length of a list can be increased or decreased by adding or removing elements from it. So in here, I'm going to use Because see, in every case, we're not going to use the default values we cannot give the values right away there is a possibility or there are going to be a lot of use cases where we will be providing or assigning values to a variable while we are going through a program to our workflow. So for that, we always use assign activity. So first and foremost, let's use an assign activity assign activity where does is, this is like the expression to or the value or whatever it is, is what we need to assign to a variable which is put on the left hand side of this activity.

So, in here, we'll use items, which is a list, right? And we're gonna say First, we're going to say we're going to initialize this, this is only specific to the items are the list data types, that you know, we have to mention that it's a new list of string type. Right? And then, let's say we want to so list is also called a collection. Right? It's, it's like these terminologies are used interchangeably.

What we do is we want to add some value to this list or to this collection, then we have an activity called add to collection, we simply put it here, and the collection is going to be items, right because that's the list name that we have. And the item, the item that you want to add to this list is going to be because we already have a string datatype and this is a, this is a list of string data type of multiple strings, right? So what we're going to do is we're going to assign this string variable and we are going to add it to the items list right. So as you can see, that there is some error right? Let me show you what it says first and foremost, because we need to debug these issues as they come right. So it says that we are using, like the value that we are providing as the item is the variable of string type.

But the list is said to be of object type. Instead, you can see the, like the last line in this error that says that it's an object type. So what we're going to do is the type of argument that we're providing has to be a string type. That's it, you see the animal is gone. That means you're like, at least from the compiler standpoint, you're able to add the data correctly to the list. There could be a runtime error, of course, but for now, that's how it is.

And then what we can do is if you want to check how to retrieve data from a list, what we usually do is we go through a loop, but we'll be discussing loops in our next chapter. But what it does is we start a loop where we're gonna see what are different values we can put in or we have in this list. So what are we gonna do is we're gonna we're reading through the whole list and we're printing the values as we encountered them within that list. That's what it is doing. We will be discussing this in our subsequent chapter. It's one of the very important concepts, but we are just starting a loop or a repetitive sequence of actions that we are going to traverse through the list, one by one.

And as soon as as we pick one item, we display it as we pick the next item we display. So that's how it is. And if we run this, you can see that we assigned the only element was what we assigned was the string variable of which has a value UiPath. And it's a we'll do retrieve that element as well. So that's how the list data items are used. to disk, the variables of list data type.

Okay, so this covers the primitive data types. Now, it's going to be variable scope. Okay? So UiPath allows variables to be kept intact, within sequence are a flowchart, as we have seen before. This is because they shouldn't be accessible to the outside activities or for flow, depending on what sort of information they are holding and what visibility you want for a particular data to be. Right.

And the sequence or flowchart in this case defines the scope of visibility of that variable. Right. And each time you create a sequence, a new scope starts. And if a variable is made available to the entire workflow, like pretty much all the variables that we have used in here, they're called global variables because they can be accessed throughout the whole program. Right? Perfect.

So we should always be you know, very cautious of the fact that you know, the scope of the variables should be should depend on what the usability of the particular data element is going to be throughout the whole program. Next, arguments and importing namespaces along with the information and data items being used in a workflow, variable panel, which is this one in UiPath studio also provides a placeholder for arguments. arguments are the data items that hold some value. Right and are passed from one UiPath project to another. So we may have, you know, different other projects then, and we may want to pass on some data to and fro. So, that's how using the arguments we pass on those values.

And this data is stored dynamically in arguments and passed into the other workflows, thereby enhancing the scalability of our programs. So, argument types are pretty much the same as the variable types that we have just discussed like Boolean generic integer strings etc etc. But alongside they have a direction associated with them which defines as to where the data is supposed to you know go or which defines the information stored in them is supposed to be transferred is it going to be you know in or out or something, these are the different directions that are supported within UiPath for arguments. So, in the arguments with indirection are supposed to be used within the current project itself. These are used to receive the value passed on to them from external workflows. Right.

Similarly, for the outwards arguments with this direction are used to pass information from the current workflow to some other workflows for their for the computations Then we have in and out which is which are like those arguments which can be used to either pass information to other workflows as well as receive information from them as well. And for the property direction, publication is not currently used within the UiPath studio. So, you can probably ignore it Okay. Now, the namespaces in UiPath namespaces are logical groups provided by dotnet framework that stores different types of data collectively, right. So, you can see in here as well, once you will selecting this is like, you know, you can import the namespaces and they can be used into the current workflow using this panel and you can select the import option as well to do you know, get all the possible data types that we may use in our current workflow.

For example, like predefined data types, like data table, data column Data View, etc, can be used by importing system dot data dot namespace. Right. But in most cases, when using a particular data type as variable or argument, the underlying namespaces automatically imported by UiPath. Instead of we have, we don't usually have to manually import it. So this feature minimizes our work and escapes the trivial route of learning complex data structures and library packages. So we don't probably have to worry much about this as well.

Once you'll be using that data type. It will be automatically there. Right? All right. This pretty much concludes the data variables, the arguments, the types and how variables are used within a workflow and we also discussed two activities, the messagebox activity and the Assign activity. I also want to touch on another activity called right line activity.

So what happens is messagebox actually stops the execution of a workflow. Let's say if you want to print the value of a variable in between or you want to print a message, the workflow would be stopped unless you bring unless you click on the OK button. But for right line activity, what it does is, if you want to print the value of a variable, let's say you want to print the string variable, you can do that. And it won't stop the execution of the workflow. But what we'll do is in the output panel itself, it will print the value of that particular variable or the message or the whatever we are trying to do. So just to give a quick example on that as well, it ran and it the bot finished the execution, you can check the output panel.

It says that the execution started and UI path which was the value of the string variable and the execution ended as well. Alright

Sign Up

Share

Share with friends, get 20% off
Invite your friends to LearnDesk learning marketplace. For each purchase they make, you get 20% off (upto $10) on your next purchase.