What might be the reason for this error?

datatable
excel
workflow
error

#1

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!!!


#2

do you mind attaching workflow.


#3

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

Please have a look!


#4

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


#5

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


#6

@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 ??


#7

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”


#8

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))


#9

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


#11

@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 ?


#12

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