UiPath: Commonly Used Variables

I’ve written this for a very good reason.

And no, it’s not because I’ve run out of topics, in fact I’m bursting with ideas, but am too lazy to jot them down before they vanish into the abyss they sprang out from.

Now that we have that out of the way, lets head back to why I wrote this article.

I’ve noticed that many are unaware of key differences that separate variables from one another.

What exactly makes a string, a “String”?

You understand that abcd is a string, and “1234” is a number…

 And you’d be wrong.

abcd is meaningless, while “1234” is a string.

It has to be contained within quotations, for the complier to recognize it as a string.

Can “1234” be an Integer? But it’s a string, so how is that possible?

Stuff like this is crucial, before you move onto advanced concepts.

So lets dive right into it.

String, Integer, DateTime

These are no-brainers.

They aren’t hard to handle, and most of us are aware of how they ought to be used, what sort of data it can store, and how to convert one type to the other.

“1234” is in string format, but it can be converted to Integer since the elements are numeric. To check out whether a given string is numeric, simple append a .IsNumeric Method and it will bring back either True or False, signifying that it is a number, or not, respectively.

 (“1234”).IsNumeric        //Returns True
 (“1234 ”).IsNumeric        //Also returns True

“1234abc” on the other hand, cannot be converted to Integer because it’s simply too darn obvious.

("1234abc").Numeric       //Returns False
Strings containing Numbers with spaces can be converted to Integers, as long as they are Trailing Spaces.


As the name suggests, DateTime is data represented in “Date” and “Time”.

You have a date, and timestamp grouped up into a single variable.

[05/06/2021 12:43:26]     //The format is [MM/dd/yyyy hh:mm:ss]

To convert a date to other formats, you have to convert it into a string, and pass in the desired format.

DateTimeVariable.ToString(Format Goes Here)

Can We Convert Integers to DateTime?

What might at first seem like a dumb question, is not really all that dumb.

We often end up having to work with Dates that aren’t in its Date-ish format. Excel sometimes decides to store dates into formats, that only God knows why are even considered a “format”.

Apart from the actual Date format we are used to dealing with, it also presents itself in Integer or double format, so that it can scare the living crap out of us.

Welcome to the crazy world of programming. I’ll be your host, until the damn thing drives me crazy as well.

In case you were wondering what OADate is, it refers to some sort of gobbledygook which only serves to further obfuscate readers with its pointless technical jargon.

For some godforsaken reason, a handful of developers over at Microsoft thought it would be great if they made a convention out of the fancy formula given below:

OADate=((DateYouWishToButcher)/(24 x 3600 x 1000)) + 25569

I’m not sure if the formula is accurate, but I am sure I will never use it.



While normal variables store individual data, Arrays store collection of data in fixed size.

New System.String(1){“Hello”, “World!”}

The arrays given above has its size initialized to 2, as the indexing starts from 0.

You cannot add more items to the array, and it will throw an error if you do.

Also, since we have declared the Array as String, it will only accept String Values.

Here’s something flashy to look at.


Lists are just like Arrays, in that they store data collections, but it isn’t limited to any given size, or given data type, which is why they are called Generic Collections.

It will store anything, and you can go on appending or prepending whatever you want to it.

It isn’t an accurate depiction, but you get the point.


DataTables are by far, the most commonly used vehicle of transport. It is super convenient for segregating and storing data, which is why we use it a lot.

But we can’t simply plug in a DataTable and filter or project the data we want. It has to get converted into a collection of DataRow.

If you skip this step, then the complier will get upset and start throwing error fueled temper tantrums.

The conversion is done by appending a .AsEnumerable Method:

More flashy illustrations to keep you engaged.


Dictionaries store data in Key-Value pairs, which can be really useful in situations like this.

I got bored, so I made some more illustrations.

Dictionaries are often the end result of LINQ projections.

We don’t usually start from a Dictionary and develop the LINQ. It’s the opposite that mostly occurs.

A DataTable with two or more columns are good candidates for conversion, which can be plugged into other LINQ queries within the same workflow, if at all required.

Dt.AsEnumerable.ToDictionary(Function(k) k(0).ToString, Function(v) v(1).ToString)

Bonus Variable: Somethin’Enumerable<Somethin’>

When dealing with projections, the end result is always a collection that gives newbies goosebumps.

But it is nothing to be worried about.

All you have to do is append a .ToArray or .ToList Method to the end of the projection, and you are set.

Your Somethin’Enumerable<Incomprehensible> is neatly tucked up into a List<DataRow> or a Array<DataRows>, which can be further converted to a DataTable once you append a .CopyToDataTable Method to it.

That’s even better!

And that’s it for today.

You might work with few other datatypes, but whatever we have covered so far are probably the only ones that will ambush you in your projects.

Once you are confident enough, you may move onto LINQ.

Leave a Comment