Forum Discussion
Hi, the issue is that your business rule CG_StatisticalCalcs tries to put a value in a parameter/ datatable/ object where the type of Decimal is expected. However the number that is processes is too big to fit in the Decimal specifications.
Decimal is already very big 28 to 29 significant digits, so i would suggest investigating your data where this very large number is comming from.
- ChristianW3 years agoValued Contributor
With VB.net, it is possible to calculate with larger number than what the datatype decimal allows you to do, by using floating point data types (single and double). Of cause, to store it back to Onestream, it needs to fit to a decimal datatype. But if only the intermediate results are to big something like this will work:
Dim scriptS As String = "..." Dim scriptT As String = "..." Dim number1 As Double = api.data.GetDataCell(scriptS).CellAmount 'i.e. 1000000000000000000 Dim number2 As Double = api.data.GetDataCell(scriptS).CellAmount 'i.e. 1000000000000000000 Dim number3 As Double = api.data.GetDataCell(scriptS).CellAmount 'i.e. 1000000000000000000 Dim result As Double = number1 * number2 / number3 Dim resultDec As Decimal = result api.Data.SetDataCell(scriptT, resultDec, False)
So, if your calculation only fails, because it has problems with intermediate results (and with statistics this is possible), but the final result are in the range of a decimal, you can calculate it like this.
Be aware, like in Excel, scientific notification looses precision the larger a number gets, so it might not be 100% correct (That's the reason, we are using decimals instead of floats).
Related Content
- 7 months ago
- 4 months ago
- 10 months ago