Skip to main content

 

I have a form with two number fields that have been set in K2 designer to have 2 decimal places. When values are entered and saved back to my database through a SmartObject it works fine whether they are whole numbers or not. For example it would accept 500.00 or 500.50. However when I read these values back into these fields the form won't accept them if they are not whole numbers, and brings up an error message saying "Input string was not in a correct Format". For example it will accept 500.00 but not 500.50.

 

The columns in the database are set as decimal(18,2) and the fields on the form are set as numbers with 2 decimal places. 

 

Has anyone experienced this before? Any suggestions are welcome! 

 

Thanks. 

Hi. 


 


Which version of SmartForms sre you currently using?


 


Also which type of control sre the values within the SmartObject being loaded into?


 


Regards,


Hi OCR-6


 


How did you create you view?


Did you generate your view from the SmartObject?


 


I created a SmartObject with two columns both set to Decimal data type, I generated a Item View from this SmartObject and tested the view with different decimal values by saving the values from the view to the SmartObject and loading them again. I tested (500.00, 500.50, 5123,12, 564.05, 500.30, 500.20, 500.10) they all saved and returned as expected.


 


Please ensure that bot your smartobject and view has the data type container of "Decimal".


Hi,

 

I checked the SmartObject and the property types were set to number. I tried to just edit them to set to decimal but it kept changing back to number. This is because when the SmartObject was created off a database table, those columns weren't set to decimal they were set to number. I just re-created the SmartObject again and it now works fine!

 

Thanks for the responses.


Hi,


 


Im glad you managed to resolve the problem you had, don't forget when making changes to your smartobject that is associated with a database table it inherits the property rules of the table its created within. So by making the changes in the table it would resolve your problem with the smartobject. ;-)


 


Nelly


Hi OCR-6


 


Thank you for you feedback regarding this issue "saving decimal values from a view to a SmartObject and loading them again".


I am glad we were able help in finding a solution to your satisfaction.


Hi , 

A 've the same problem with decimals field in smartforms with 2 places. I checked type filed in  smartobject (Decimal), view(Decimal) , database (decimal(18,2). When I run create method i get the Error "Failed to convert parameter value from a String do a Decimal." Stupid problem ,which stopping my work 😕  When I reset Style  Decimal fields to default  create method run correctly but it's not resolve!!  . ver . 4.6.8

 

Any suggestion ? Help ? :)


15452i277E867F5F54CAD6.png
15835i42561B3DC52CDD8D.png
11234i2A716D7A0145D84B.png

Reply