Adjust rounding with expressions
Anonymous
Not applicable
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2018-11-09 10:24 AM
2018-11-09
10:24 AM
if the first decimal is 0-4 round down
if the first decimal is 6-9 round up
if the first decimal is 5 and if the number before the decimal is odd round up, example 93.5=94 m2
if the first decimal is 5 and if the number before the decimal is even round down, example 94.5=94 m2
Is it possible to set this up as a rule for a property in AC22 by using expressions?
Stig
Labels:
- Labels:
-
Data management
1 REPLY 1

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2018-11-09 03:46 PM
2018-11-09
03:46 PM
You might try:
IF ( {Property:Expressions/frac} > 5, ROUNDUP ( {Property:Expressions/num}, 0 ), IF ( {Property:Expressions/frac} < 5, ROUNDDOWN ( {Property:Expressions/num}, 0 ), IF ( MOD ( {Property:Expressions/dig}, 2 ) = 0, ROUNDDOWN ( {Property:Expressions/num}, 0 ), ROUNDUP ( {Property:Expressions/num}, 0 ) ) ) )
Where:
num = your measurement in a raw number (no units)
frac = QUOTIENT ( MOD ( {Property:Expressions/num}, ROUNDDOWN ( {Property:Expressions/num}, 0 ) ) * 10, 1 )
QUOTIENT ( MOD ( {Property:Expressions/num}, ROUNDDOWN ( {Property:Expressions/num}, 0 ) ) * 10, 1 )
dig = QUOTIENT ( MOD ( {Property:Expressions/num} / 10, ROUNDDOWN ( {Property:Expressions/num} / 10, 0 ) ) * 10, 1 )
QUOTIENT ( MOD ( {Property:Expressions/num} / 10, ROUNDDOWN ( {Property:Expressions/num} / 10, 0 ) ) * 10, 1 )
i can't imagine that anyone would use such a complicated expression.
This just demos the "left turn" Graphisoft took in developing expressions?
IF ( {Property:Expressions/frac} > 5, ROUNDUP ( {Property:Expressions/num}, 0 ), IF ( {Property:Expressions/frac} < 5, ROUNDDOWN ( {Property:Expressions/num}, 0 ), IF ( MOD ( {Property:Expressions/dig}, 2 ) = 0, ROUNDDOWN ( {Property:Expressions/num}, 0 ), ROUNDUP ( {Property:Expressions/num}, 0 ) ) ) )
Where:
num = your measurement in a raw number (no units)
frac = QUOTIENT ( MOD ( {Property:Expressions/num}, ROUNDDOWN ( {Property:Expressions/num}, 0 ) ) * 10, 1 )
QUOTIENT ( MOD ( {Property:Expressions/num}, ROUNDDOWN ( {Property:Expressions/num}, 0 ) ) * 10, 1 )
dig = QUOTIENT ( MOD ( {Property:Expressions/num} / 10, ROUNDDOWN ( {Property:Expressions/num} / 10, 0 ) ) * 10, 1 )
QUOTIENT ( MOD ( {Property:Expressions/num} / 10, ROUNDDOWN ( {Property:Expressions/num} / 10, 0 ) ) * 10, 1 )
i can't imagine that anyone would use such a complicated expression.
This just demos the "left turn" Graphisoft took in developing expressions?
Gerry
Windows 11 - Visual Studio 2022; ArchiCAD 27
Windows 11 - Visual Studio 2022; ArchiCAD 27