Wrong type when creating a variable

When I create a variable by the top menu button and choose “Number” (look at the screen) as the type it creates a variable of the “Generic Value” type. Is it normal? Bug

To avoid any confusion, you should change the type of the variable to Int32 manually by clicking on GeneralValue at the bottom.

Yeah that’s what I do but anyway it’s a strange thing

Hi @MGMKLML,

It is normal. No strange thing in that. Because whenever you create a new variable as integer, then the Variable type will be generated as GenericValue but it is Integer, right! So the default value will be as 0 by default, unless you don’t change it. So it will work as Integer only.
Same as Date and Time variable. You can verify that too.

Regards,
Hemal

Thank you for your reply. What if I type, say, 1.24 as the default value? Will it behave like a double value or not?

Yes. See, you have created a variable as integer that’s why default value will be as 0 (as it is integer value). If you change it to “ABC” then it will behave as a string. If you change the default value as double then it will behave as double only.

Hope you got it. You can do it practically. :slight_smile:

Regards,
Hemal

Thank you. But I remember that when I created a GenericValue and filled it with an integer, some operators like “if” worked incorrectly, meaning it failed to properly compare different numbers.

It is not “normal”. There is a button to create a Generic Value, using the Number button should create an Int32 and not a Generic Value, this is simply bad design.
As @MGMKLML states, using a Generic Value as an integer can bring problems.

@bartierc I feel like it’s a kind of bug that they will pay attention to and hopefully fix.

1 Like

100% agree

Hi,

I’m a new UIPath User and I’m practicing creating Genericvalue variables. When I create the drag the writeIn Activity, add the Concatenation A+B and attempting to create the variable at the bottom of the page. GenericValue is under scope instead of VariableTypes like in the demo.


Can anyone help please?

Thank you!