Change the default type of created variables

Hello guys, I would like to know if there is any way that I can dynamically change the default type of the variables that are created (Ctrl + K), I know that all variables created in this way have the String type by default, but there is a way to condition it with the variable prefix?
That is, if the variable that I am creating starts with str_ the type will be string, if it starts in int_ the type will be int32 and in this way with several types of variables

Hi @Juan_Esteban_Valencia

Develop a custom workflow or script that takes input for the variable name and prefix. Based on the prefix, it dynamically creates variables with different types using the appropriate activities or code.

Thanks!!

C# is a strictly typed language. You cannot declare a variable’s type dynamically based on its name. However, UiPath does provide flexibility through the use of ‘GenericValue’ variables that can hold any type of data. But directly inferring the type from the name or prefix isn’t a feature.

@Juan_Esteban_Valencia

You cannot create like that…

But if you use ctrl+k in any firld you need…it would create the variable of that required type but not only string

String is created by default only in assign activities

If you create a variable in the datatable field then it would be created as datatable type

Cheers

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.