Level 1

0% to

Level 2

Tip /

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

View all

# Adobe Experience Manager Sites & More

SOLVED

## How do you calculate formatted values

Level 2

I'm trying to calculate the total of 2 fields which have been formatted using math.floor; I want to calculate the formatted amount of these 2 fields, NOT the rawValue.  How can I do this?

example:

Field 1 rawValue = 700.44                                    Field 1 formatted value = 700.4

Field 2 rawValue = .42                                          Field 2 formatted value = .4

Total rawValue  =  700.86 (rounded 700.9)          Total formatted value = 700.8 ;  this is what I need to do

1 Accepted Solution

Try this:

`(Math.round(700.44*10)/10)+(Math.round(0.42*10)/10);`

Thanks!

4 Replies

Try this:

`(Math.round(700.44*10)/10)+(Math.round(0.42*10)/10);`

Thanks!

Level 2

Awesome!  I was soooo close.  Thanks so much!!

Level 2

This formula worked but taking it one step further, I'm trying to leave the field (headwaterExistingMain10) blank unless there is an amount in one of the fields in the formula using this..

this.rawValue==null

....When I Preview the form I get this error...

"Illegal value: cannot assign 'True' to xfa[0].form[0].form1[0]0.page1[0].table1[0].row5[0]0.headwaterExistingMain10[0].#value[0].#float[0]."

The kicker is once I click on the 'ok' button in the error box the formula works.

Employee

@ReluctantProgrammer Thank you for sharing your answer with the AEM community. Keep the great work going. Looking forward to see more contribution from you in future.