Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Adobe Summit 2023 [19th to 23rd March, Las Vegas and Virtual] | Complete AEM Session & Lab list

Decimal or Whole Number Question

Avatar

Level 2

How can a numeric field's numeric pattern (or javscript) be set up or coded to return a whole number or 1 decimal when the number has an exponential. For example, I'd like the same field to return a whole number when 120/12 = 10 and when the calculation returns a decimal (i.e. 131/12 = 10.916666) the number would return as 10.9.

I am ok with using a numeric pattern or javascript code.

2 Replies

Avatar

Level 7

You can use the JavaScript Round function. Math.round()

Avatar

Level 10

Use the symbol 8 right from the decimal point in you numeric pattern.

num{zzz,zzz,zz9.8}