Assign Null or empty value to variable of type Double or Integer

Hi community,

I have a scenario where i am extracting a score from screen in a variable of type double.
But sometimes, a scenario can exist when this score is not there on screen. In that case it is expected that variable should be null or empty but in my case 0 is getting assigned.

Please suggest.

Hi @Akshat_Sharma1 ,

Could you let us know what activity are you using to get the score from the screen ?

@Akshat_Sharma1

That’s the default value you are getting assigned
But from screen if you are getting null then you are getting that as a string, not as an Integer right?
So that instead of assigning the value to the Double or Integer variable you can check and throw the exception

Hope this may help you

Thanks,
Srini

I am using extract data table activity since its table on screen with multiple rows of data.

Hi,

In theory, Nullable<Double> or Nullable<Int32> type will work. For example, GetText returns numeric value if there is number and returns null if there is no data.
However, extract data table activity returns empty if there is no data and it’s necessary to convert it to null if use nullable<T>

image

Regards,

.