AaronMark
(AaronMark)
August 26, 2021, 2:21pm
1
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”
And my inser command on uipath:
I get the same error if I use the direct insert data table.
Can anyone help me? I don’t understand what it could depend on. Thanks a lot!!
Aaron
Jeroen
August 26, 2021, 2:33pm
2
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.
AaronMark
(AaronMark)
August 26, 2021, 2:45pm
4
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.
AaronMark
(AaronMark)
August 26, 2021, 2:46pm
5
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.
Jeroen
August 26, 2021, 2:51pm
6
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
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
AaronMark
(AaronMark)
August 26, 2021, 3:12pm
8
OMG! 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
system
(system)
Closed
August 29, 2021, 3:13pm
10
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.