Expand my Community achievements bar.

Enhance your AEM Assets & Boost Your Development: [AEM Gems | June 19, 2024] Improving the Developer Experience with New APIs and Events
SOLVED

Number of decimal points on calculate field

Avatar

Former Community Member

Hello,

What script can I use to specify how many decimal points I want included in my output rawValue?

Cheers,

Wes

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi Wes,

Actually you don't need to script anything for that. It is already implemented in the object Palette of the decimal field.

Open: Object Palette ► Field

As your Type of field should be Decimal Field you should be able to see under Pattern ► Limit Leading Digits & Limit Trailing Digits

"Leading Digits" means numbers before the comma

"Trailing Digits" means numbers after the comma

If you are looking for some kinda currency or percentage, you can also use the Pattern num.currency{} OR num.percent{}

View solution in original post

2 Replies

Avatar

Correct answer by
Level 10

Hi Wes,

Actually you don't need to script anything for that. It is already implemented in the object Palette of the decimal field.

Open: Object Palette ► Field

As your Type of field should be Decimal Field you should be able to see under Pattern ► Limit Leading Digits & Limit Trailing Digits

"Leading Digits" means numbers before the comma

"Trailing Digits" means numbers after the comma

If you are looking for some kinda currency or percentage, you can also use the Pattern num.currency{} OR num.percent{}