Throuble converting String to Int

com
Hi guys, l’m having throubles with this convertion, l’m taking the srtError from a transaction and then l want to convert it to int but at the moment of execution it throws an error saying: Input string was not in a correct format.
How do l do it?
Thanks

HI
Welcome to uipath community
to convert a string to int
kindly use this expression
Convert.ToInt32(your string variable)

Cheers @kevinymg

@kevinymg,

For this conversion your string strError should have only numeric values, if it has some characters then you need to extract numeric values alone from it and have to convert it.

Provide some sample value of strError value.

com1
It has only numbers, look

Hi, thanks
I tried with that aswell, it didn’t work either

Can i have the value to be converted to int32
@kevinymg

You can see it on the image above, The one that says strError it only has “1” as value

Please try using : Convert.ToInt32(strError).

this should work actually
convert.toint32(“1”)

may i know what error you are getting while converting with this expression
Cheers @kevinymg

That doesn’t throw any error, the problem is that l need the value of the variable
The problem must be the variable strError, lt is declared as string and l convert the transaction value to string but l don’t know what’s happening

I didnt get that budddy
you say you dont receive any error, so is it converting to in32
or can we have the screenshot of how the expression is used
Cheers @kevinymg

Hi @kevinymg,

What’s inside your condition?

l meant to say, with this → convert.toint32(“1”)
It doesn’t throw the error, but with this → convert.toint32(“strError”), it doesn’t work and this is the one l need because the value of “strError” change.

The expression is not used, it is just an assing activity, l plan to use the variable when it works

Hi,
Condition is just the name of the variable, it is declared as int32 if that’s what you’re asking

that shouuld be mentioned liike
Convert.ToInt32(strError)
remove the double quotes
@kevinymg

1 Like

:man_facepalming:
My bad, of course lol
TY

2 Likes

Cheers @kevinymg

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