Error import datatable on db - Incorret decimal value

Sorry for my quest…
I’m trying to import an excel sheet containing columns
General format and Dates format into a db.
Some columns in General format contain amounts.

I’m trying to import the sheet to DB, but it always fails when the cells
with the amounts are empty.

What could be the problem?
On my db, the ammount cells are formatted as “decimal”

image

And my inser command on uipath:
image

I get the same error if I use the direct insert data table.
image

Can anyone help me? I don’t understand what it could depend on. Thanks a lot!!
Aaron

Perhaps when the cell is empty, it is not properly converted to decimal? You could use write line convert.ToDecimal(row.Item(“Capitale_Affidato_1B”)) before the SQL statement to test how it looks.
If the empty decimal is the problem, you could give it a default value.

Hi @AaronMark ,

It’s better to put 0 value instead of blank if the column type is decimal in sql table.

that’s what I did, when I use direct table import.
The Bot then goes into error in assigning the variable.

How do I check the cell before converting it?
or to write 0 in the db, when the cell is empty?

Sorry, I’m a little lacking in this.

I think at this point that my problem is to understand first if the cell is empty or not, and then to assign the variable.

You could try IF row.Item(“Capitale_Affidato_1B”) = "" THEN Assign row.Item(“Capitale_Affidato_1B”) = 0

EDIT: You might need to finetune this a little bit

You can check before passing it to parameter like this

image

And pass variable instead of row(“Capitale_Affidato_1B”)

Ignore errors as i have not used foreach, it’s just to show you.

1 Like

OMG! :expressionless: It was such a simple thing!

Ok … sorry for my stupid post.
I solved it and it works.

Thanks again!!

No worries, it happen sometime :slightly_smiling_face:

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