Support » Plugin: Calculated Fields Form » Round to the next 10

Viewing 8 replies - 1 through 8 (of 8 total)
• Plugin Author codepeople

(@codepeople)

Hi,

The process is simple, suppose the name of field is “fieldname1”, then the equation would be:

ceil(fieldname1/10)*10

in a step by step, using the number of demo:

ceil(1432/10)*10 = ceil(143.2)*10 = 144*10 = 1440

flabrea

(@flabrea)

thanks so much! i guess now it is gonna be complicated. how can i display that rounded number with 2 decimals? 1440.00? ðŸ™‚ thanks!

Plugin Author codepeople

(@codepeople)

Hi,

There is available an operation in the calculated fields, prec(x,y), where y determines the decimals numbers. In your particular case the equation would be:

prec(ceil(fieldname1/10)*10,2)

flabrea

(@flabrea)

That all worked out pretty good!

Now what does the equation look like if i want to round to the first tenth after the decimal? Like 30.28 to 30.30?

`fieldname90*0.16+fieldname92`

All i get is 31.00 from 30.28?! Thanks for your help!

Plugin Author codepeople

(@codepeople)

Hi,

Follow a similar logic using mathematical expressions:

if you have 30.28, and you want 30.30

prec(ceil(30.28*10)/10,2)

It is simple. I will develop the equation, step by step:

prec(ceil(30.28*10)/10,2) = prec(ceil(302.8)/10,2) = prec(303/10,2) = prec(30.3,2) = 30.30

prec(ceil((fieldname90*0.16+fieldname92)*10)/10,2)

That’s all.
Best regards.

flabrea

(@flabrea)

thanks. works perfect!

flabrea

(@flabrea)

looks like i am really to stupid to this myself.

how can i transform 543,04 into 544,00? my experiments do not work ;(

Plugin Author codepeople

(@codepeople)

Hi,

Exactly in the same way:

prec(ceil(543.04),2)

Best regards.

Viewing 8 replies - 1 through 8 (of 8 total)
• The topic ‘Round to the next 10’ is closed to new replies.