What might be the reason for this error?

I am getting an error which I am not able to troubleshoot and find the reason behind it .

The above is the screenshot of the error. I am working on a workbook sheet activity.
When the error pops up, the “ASSIGN” activity I used is highlighted.

This is the expression I used to add data from two columns of an excel sheet and I dont see any syntax error.
“(Integer.Parse(row.Item(5).ToString) + Integer.Parse(row.Item(6).ToString))”

THE MAIN THING IS : I got the perfect output one day back,running the same workflow. But now, Its not working. What might be the reason for that??
Can anyone please HELP ME with that???
I am new to UIPATH and have just started learning things :slight_smile:
Thanks in advance!!!

do you mind attaching workflow.

1 Like

Thanks for immediate response. This is the workflow !! true.xaml (22.1 KB)

Please have a look!

I’m quite certain that in this case your input strings(row.Item(5) and/or row.Item(6)) can not be interpreted as integers. If they have letters or special characters in them this error would occur.

You could use Integer.TryParse(row.Item(5), output), if the input string can not be converted this method will return False, else it will return True.

Br,
Topi

you have all the percentage variable in generic type please change to int and try.

@Topi I replaced Parse with TryParse , but It is showing syntax error…

“(Integer.TryParse(row.Item(5).ToString) + Integer.TryParse(row.Item(6).ToString))”
Is this the way to use TryParse ??

I tried that, but C’ant do that because I have used the expressions like
"percentage* 6 /100 " …So it shows compiler error : “dissallows implicit conversions from double to integer”

TryParse returns a boolean, so essentially you would have to check in an if clause first and then do the conversion.

It appears that in this case you are trying to convert possible double values to integers. So instead of parsing them to integers why not use double values? (Double.Parse(row.Item(5).ToString) + Double.Parse(row.Item(6).ToString))

assign percentage=Convert.ToInt32(total*10/100)

@ddpadil
Thanks a lot.Now, It worked!!!
But now the same error at “Write cell activity”
“dissallows implicit conversions from string to double”
I tried Convert.todouble(“H”+rowindex)… But still error.
Should I change the variable type of rowindex ?

Hey @UnicornStark

I am not aware what is your need of datatype you wants but just for your reference try like this.
if your rowindex is of integer type then no need to convert it.

“H”+(Convert.ToInt32(rowindex).ToString

Regards…!!
Aksh