Jump to content
  • 0

Rounding in localization not being applied - syntax for Round() complex equation?


roattw

Question

The rounding applied in location did not work.  Still getting calculation with 4 places after decimal, want none.  Tried to us Round() in the calculated field but always throws syntax error.

For example, this calculation works:  (4*[@field:Burn_Amnt]*[@field:Weight])+(1500*[@field:BSA])

But every which way I try to apply Round() to it it throw invalid formula error.

 

As always, thank you!

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0

Were you trying the syntax below? It worked for me.  You'd need to encapsulate the whole equation in an outer parenthesis before using it as an argument.

ROUND( ( (4*[@field:Burn_Amnt]*[@field:Weight]) + (1500*[@field:BSA]) ), 0)

 

 

Next, , were you trying to implement it on a Table or on a DataPage?

If it's on a DataPage and the syntax didn't work for you, you can simply change the localization to NOT show the decimal. But it probably get the FLOOR of the result instead of round.

 

Hope this helps.

Regards,

DN31337

 

image.png

Link to comment
Share on other sites

  • 0

Odd, I have that Custom setting set for 2 decimal places.  No effect.  Its also set for 2 in the localization.  But no decimal, and the calculation whould have many digits to the right of decimal.

The Caspio (SQL?) calculation and rounding error seems odd.  I run the same formula/calculations in Excell I get one answer.  I run it in another web-based Excel to App converter, same results as Excel.  Run it in Casio and the rounding error is much more pronounced.  Calculated values off by several counts (for example 2886 in Excel, 2880 in Caspio).

 

rounding.thumb.png.23e544832df73080483ab5c7dd408aee.png

Link to comment
Share on other sites

  • 0

Hi - Just to add on this post. If you would like to format the number field to two decimal places - For example, on whole numbers such as 16, it would be 16.00.

You can use this formula

STR([@field:Number], 6, 2)

The STR() function returns a number as a string.

Result:
16 = 16.00
15.345878 = 15.35

References:
- https://howto.caspio.com/function-reference/#:~:text=Str(number%2C length %2C precision)
- https://www.w3schools.com/sql/func_sqlserver_str.asp

Link to comment
Share on other sites

  • 0

Hello - if you want to use ROUNDDOWN and ROUNDUP like from Excel, you can use these formulas:

Excel:

Round to last nearest 5 = ROUNDDOWN(A2/5,0)*5
Round to last nearest 10 = ROUNDDOWN(A2/10,0)*10
Round to last nearest 50 = ROUNDDOWN(A2/50,0)*50
Round to last nearest 100 = ROUNDDOWN(A2/100,0)*100

Caspio:

FLOOR([@field:Number]/50)*50

Excel:

Round to next nearest 5 = ROUNDUP(A2/5,0)*5
Round to next nearest 10 = ROUNDUP(A2/10,0)*10
Round to next nearest 50 = ROUNDUP(A2/50,0)*50
Round to next nearest 100 = ROUNDUP(A2/100,0)*100

Caspio:

CEILING([@field:Number]/5)*5

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...