Variable/Argument Type Inference

Hi Team,

I would like to suggest a new feature to UiPath Studio.

When we declare a variable using Ctrl+K shortcut the default behavior is create this variable as System.String. Previous versions of UiPath used UiPath.Core.GenericValue. Same for arguments (Ctrl+M).

We often just drag’n’drop a few assign activity, declare the variables using the shortcuts, and then start the journey to set all the correct types.

We need go to the Variables panel, start change the types one by one and if the type is not in the DropDownList (very common) we need go to Browser for Types…

image

…then search for the type we want to finally select it.

image

This process is even boring when we have .NET Generic Types and the argument type is not present in the DropDownList, is a journey inside a journey :sweat:

image

Maybe is not big deal with a few variables in a small project, but for medium/large projects we have a bunch of variables and doing these steps all the time is pretty boring.

My suggestion is add a button “Resolve By Inference” (or something like that) on Variables/Arguments panel. This button should only appear if there is any variable with wrong type in the workflow.

image

Once we click in this button, the Variable Types are resolved by inference using the value assigned to the respective variables/arguments.

Another option in add to this, is auto infer the type if the Value of the Assign activity was already set.

1 - Value set to 0 (zero):
image

2 - Ctrl+K to create a variable:
image

3 - Why System.String? It could be an System.Int32 since the value was already set:
image

It would be a great feature. :slightly_smiling_face:

1 Like

Thanks for the detailed feedback. Sent this to our backlog.

2 Likes

Great suggestion. I would also contribute with an idea…
When creating a variable with ctrl+K , I know for example that what I want is an integer so I could just write ‘int MyVariable’
image
and the compiler would see preceeding keyword ‘int’, and just imidiately put that variable as an Int. Atleast for all the ‘popular’ ones: Int, string, datetime etc.

1 Like

Great idea @Petar_Soce

Maybe it is also easier to UiPath team implement.

Even if it is require to specify the full name it will be something much better than using the UI to pick up the desired type.

Set Var: System.Int32 myInt
Set Var: System.Collections.Generic.IEnumerable<System.DateTime> myDates
Set Var: System.String[] myArrayOfString
etc.