Skip to main content
Question

Rounding attribute value up to closest 100?


Does anyone know how to round an attribute value up to nearest 100 ? For example if I have a value 1367 I want it to be rounded to 1400. And if I have a value of 1305 I also want it to bo rounded to 1400. I tried the AttributRounder, but it seems to only round decimal values.

 

//Eva

8 replies

takashi
Contributor
Forum|alt.badge.img+19
  • Contributor
  • May 9, 2014
Hi Eva,

 

 

Try this expression with the ExpressionEvaluator.

 

-----

 

@ceil(@Value(attribute_name)*0.01)*100

 

-----

 

 

See the help on the ExpressionEvaluator to learn more about @ceil function.

 

 

Takashi

  • May 9, 2014

 

Hi Eva,

 

 

The AttributeRounder works fine, if you write -2 for Decimal Places.

 

 

 

Thomas

gio
Contributor
Forum|alt.badge.img+15
  • Contributor
  • May 9, 2014
or

 

(@round((@Value(Nr_to_R)+100)/100))*100

takashi
Contributor
Forum|alt.badge.img+19
  • Contributor
  • May 9, 2014
I didn't know a negative value can be used for Decimal Places of the AttributeRounder. It's simple and works fine. Thanks for sharing the tips, Thomas!

gio
Contributor
Forum|alt.badge.img+15
  • Contributor
  • May 9, 2014
Tho u can use positive or negative rdecimals in the rounder, it has less degrees of freedom.

 

 

So if u would want ot round to say 200 or 2, or even better yet 3 (no multiplication by 10 possible now..;) it would be of no use.

 

 

(@round((@Value(Nr_to_R)+100)/100))*100 gives full freedom, u can parameterise the values.

 


takashi
Contributor
Forum|alt.badge.img+19
  • Contributor
  • May 10, 2014
Gio, does the expression always work as your expecting?

 

1400 --> ?

 

1350.0 --> ?

  • Author
  • May 12, 2014
thank you all for the solutions, it's working now!

gio
Contributor
Forum|alt.badge.img+15
  • Contributor
  • May 12, 2014
...ok....that would be (@round((@Value(Nr_to_R)+99)/100))*100

 

 

:)

 


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings