Round to nearest 0.5

1592
2
05-10-2021 08:34 PM
RogerFarmer1
Occasional Contributor

Hello,

Can I round an input decimal to the nearest 0.5?

Even better, can the spinner be programmed in steps of 0.5?

I don't want to use range, as there is no maximum.

Minimum and default=0.5

RogerFarmer1_0-1620703994150.png

Thank you!

 

0 Kudos
2 Replies
JohannesLindner
MVP Frequent Contributor

Can't help you with the survey design, but to round to 0.5:

 

Multiply by 2, round to zero digits, divide by 2

var rounded_x = round(2 * x, 0) / 2

Have a great day!
Johannes
0 Kudos
RogerFarmer1
Occasional Contributor

In the end I did this: (round((${input_hours} * 2), 0)) * 0.5

RogerFarmer1_0-1620771508392.png

and got this:

RogerFarmer1_1-1620771535257.png

 

0 Kudos