I came across a problem where I need to convert a string values(Amount) to integer values. I have 2000 records and I am getting error “Add Data Row: Conversion from string “” to type ‘Integer’ is not valid” on 331st record. All previous records are getting converted just fine.
I am Building a datatable with Amount Column of int32 datatype and adding data row from other data table inside for each row where ArraryRow value is cint(row(“Amount”).tostring. Below are sample amount data. I am getting error on 110,473.11 value. Please help.
25,370.00
2,000.00
28,200.00-
1,000.00
1,718.00
900
1,500.00
1,895.00
1,895.00
1,843.30
59,846.16
2,500.00
2,500.00
2,940.00
110,473.11
9,250.00
3,026.97
150
571.49
818.86
9,170.00
2,475.20
None of the string is empty in my case. and as I mentioned all the records are getting converted until 331st record with cint(row(“Amount”).tostring. there are value before 110,473.11 which has
decimal and converted just fine.
Exception is stating this
Conversion from string “” to type ‘Integer’ is not valid”
And also replicated:
Working fine with:
sometimes we can also use an additional Trim()
In case of larger datasets we can write a small LINQ filtering out values that are not convertable and do an analysis on the result. Often we can do it directly in the immediate panel e.g.:
Error clearly states that the cell value is empty and that is the reason it is failing. Could you please share the data(just with that column) with all the records with us??
I see some empty cells but not on the row where error occurred.
In build data table activity, I have 3 columns which is updated in Add Data row activity inside a for each activity.
Column A is string, Column B is string and Column C(Amount) is Int32
local value panel is triming / cut off after a certain amount of data (… Indicator). So the problem record can also be located on later records. Thats why we do run the LINQ analysis statements. Another technique is to work with conditional breakpoints / tracepoints for reacting on certain values / situations. As shown in the screenshots from above the 110,473.11 value is parseable.