Skip to Content (Press Enter)
OutSystems.com
Personal Edition
Community
Support
Training
Training
Online Training
Developer Schools
Boot Camps
Certifications
Tech Talks
Documentation
Documentation
Overview
ODC
O11
Forums
Forge
Get Involved
Get Involved
Jobs
Ideas
Members
Mentorship
User Groups
Platform
Platform
ODC
O11
Search in OutSystems
Log in
Get Started
Back to Forums
Patrícia Lopes
98
Views
5
Comments
"Conversion overflows" error getting a decimal
Question
Hi.
I am doing a simple operation of inserting a large decimal value (100000000000000000000000) into a table.
When I try to get that record it raises a exception "Conversion overflows".
Is this problem known? Is there any solution?
Thanks in advance.
Error Detail:
Message: Could not assign '' to 'TABLE.Attribute'... Conversion overflows.
Stack:
at ssESPACE.ENTABLEEntityRecord.Read(IDataReader r, Int32& index)
at ssESPACE.RCTABLERecord.ReadDB(IDataReader r)
at ssESPACE.RLTABLERecordList.Read()
at ssESPACE.RLTABLERecordList.set_Reader(IDataReader value)
at OutSystems.HubEdition.RuntimePlatform.DBHelper.ExecuteQuery(RecordList rl, IDbCommand cmd, String description, Boolean transformParameters, Boolean skipLog)
at OutSystems.HubEdition.RuntimePlatform.DBHelper.NewExecuteSimpleQuery(RecordList rl, IDbCommand cmd, String description)
at ssESPACE.Flows.FlowFormulario.ScrnWebScreenEdit.FuncssPreparation.QueryGetTable(HeContext heContext, Int32 maxRecords, IterationMultiplicity multiplicity, Int32& outParamCount, Int32 qpRegistoId)
at ssESPACE.Flows.FlowFormulario.ScrnWebScreenEdit.Preparation(HeContext heContext)
at ssESPACE.Flows.FlowFormulario.ScrnWebScreenEdit.doRefreshScreen(HeContext heContext)
at ssESPACE.Flows.FlowFormulario.ScrnWebScreenEdit...utton.RaisePostBackEvent(String eventArgument)
at OutSystems.HubEdition.WebWidgets.Button.RaisePostBackEvent(String eventArgument)
at System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
Matthias Preuter
MVP
OutSystems is using .Net Int32 for a Integer value. These can have a
MaxValue
of
2,147,483,647 and a
MinValue
of
-2,147,483,648.
Kind regards,
Matthias
Matthias Preuter
MVP
I see the problem now, the type of the column in the database table is a decimal but i think the entity attribute type is a int. As you can see in the stack-trace the OutSystems tries to convert the value in a Int32.
sollution change the type of the entity attribute.
João Rosado
Staff
Hi Patricia,
I replicated the problem here,
From my tests the SqlClient DataReader fails then the number exceeds 7,9 x 10^20 (7,9 x 10^28 considering the 8 decimal places).
After some search I found a little disclaimer on the bottom of the
SqlDecimal documentation page
that says it only actually supports 7,9 x 10^28 instead of the supposed 7,9 x 10^38 due to implemention issues.
In my opinion is a big implementation bug on the Microsoft side. The problem is not actually inserting, but reading it.
If you really need to use decimals with that size I sugest you to submit the issue to OutSystems Tecnical Support.
Regards,
João Rosado
Patrícia Lopes
Thank you for your help.
Matthias
the attribute is a decimal with Lenght=37 and Decimals=8.
João
thank you for explaining the problem. I will give some feedback to outsystems.
Meanwhile i'll reduce de attribute length.
Ricardo Silva
Hello,
I was able to workaround this problem using the following approach:
1) having a structure to mimic the structure of your entity
2) the decimal values which you expect to have greater value than supported are converted to Text
3) use convert(varchar, [Attribute]) on the SELECT for that field
4) use TextToDecimal() on that field to convert to Decimal
You can find an example in the attached eSpace.
Best regards,
Ricardo Silva
TestDecimal.oml
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
See the full guidelines
Loading...