No ratings

How to save a rounded decimal value to a SQL database table


This article will cover how to save a rounded decimal value to a SQL database table. 


For SmartBox SmartObjects, this can be done by specifying the Decimal Places on the Decimal property as per the image below:



This setting does not apply to SQL SmartObjects. If you type in a value of "4.555", this will be saved as "4.55" on the database. In order to save the desired rounded value (eg. "4.56"), you will need to create an Expression that calls the Round Up Mathematical Inline Function.



In this example, the Price Text Box holds the decimal value:



  1. Create a new Expression.
  2. Use the Round Up inline function found under Operators > Mathematical and set it up as per the image below. The second parameter (eg. 2) depends on the scale (number of decimal places) required:RoundUp.png


  3. Click on OK to save the Expression.
  4. Go to the Rules tab and open the rule which calls the SQL SmartObject to save the value to your database.
  5. Before the Create/Update method is called, add a transfer data action:TransferData.png


  6. Map the RoundUp expression created to the Price Text Box: MapExpr.png




    1. Run the view and type in 4.555 on the Price Text Box:Test1-correct.png


    2. Click outside the Price Text Box so it changes to 4.56:Test2.png


    3. Click on the Create button and the rounded off value should be stored in the database:




Related Links

Labels: (2)
Version history
Last update:
‎03-16-2022 05:12 AM
Updated by: