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
BedrockMission!

Learn More

View all

Sign in to view all badges

Currency Decimal Places

Avatar

Avatar
Validate 10
Level 2
Gene--O
Level 2

Likes

3 likes

Total Posts

76 posts

Correct Reply

0 solutions
Top badges earned
Validate 10
Validate 1
Boost 3
Boost 1
View profile

Avatar
Validate 10
Level 2
Gene--O
Level 2

Likes

3 likes

Total Posts

76 posts

Correct Reply

0 solutions
Top badges earned
Validate 10
Validate 1
Boost 3
Boost 1
View profile
Gene--O
Level 2

07-01-2013

HELP!

I have ready many posts on this subject, and can't figure out why mine won't work - it seems so simple:

I have NumericField1 and NumericField2. I want to multipy the user entered value from NumericField1 by a fixed value (in this case .555) to return a currency rounded up to the nearest cent (hundredths decimal point). I have tried using the field pattern options, but NONE of them will round up, they just return a dollar value with 2 decimal places.

For example:

I enter "307" into NumericField1. This value multiplied by .555 returns $170.385. I want this to display as $170.39, but all I can get is $170.38.

Any help is appreciated!!!

Gene-O

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Boost 1
Level 1
Francis_Manly-E
Level 1

Like

1 like

Total Posts

26 posts

Correct Reply

2 solutions
Top badges earned
Boost 1
Affirm 1
View profile

Avatar
Boost 1
Level 1
Francis_Manly-E
Level 1

Like

1 like

Total Posts

26 posts

Correct Reply

2 solutions
Top badges earned
Boost 1
Affirm 1
View profile
Francis_Manly-E
Level 1

08-01-2013

Hi Gene,

You could also use FormCalc's Round function:

$.rawValue = Round(NumericField1.rawValue *.555, 2);

Additional information on the Round function can be found here:

http://help.adobe.com/en_US/livecycle/9.0/designerHelp/index.htm?content=001462.html

Answers (5)

Answers (5)

Avatar

Avatar
Give Back
Level 2
Kosta_Prokopiu
Level 2

Likes

13 likes

Total Posts

51 posts

Correct Reply

8 solutions
Top badges earned
Give Back
Boost 5
Boost 3
Boost 10
Boost 1
View profile

Avatar
Give Back
Level 2
Kosta_Prokopiu
Level 2

Likes

13 likes

Total Posts

51 posts

Correct Reply

8 solutions
Top badges earned
Give Back
Boost 5
Boost 3
Boost 10
Boost 1
View profile
Kosta_Prokopiu
Level 2

24-07-2020

🙂 I think there is an easier solution

 

12345/1000 on next lower cent: Math.floor(100*(12345/1000))/100   =>> 12.34

12345/1000 on next higher cent: Math.ceil(100*(12345/1000))/100 =>> 12.35

 

Avatar

Avatar
Shape 1
Level 1
Anilr1717
Level 1

Likes

0 likes

Total Posts

2 posts

Correct Reply

0 solutions
Top badges earned
Shape 1
View profile

Avatar
Shape 1
Level 1
Anilr1717
Level 1

Likes

0 likes

Total Posts

2 posts

Correct Reply

0 solutions
Top badges earned
Shape 1
View profile
Anilr1717
Level 1

24-07-2020

Hi,

 

Just posting here so anybody can use it. 12345/1000 = 12.34 not 12.35

 

Code: 12.34

 

Floor(ToDouble(@CONTENT4)/1000)+'.'
+Substring( Iif(Length(ToString(Mod(ToDouble(@CONTENT4), 1000)))<=1,LPad(ToString(Mod(ToDouble(@CONTENT4), 1000)),3 ,'00' ),
Iif(Length(ToString(Mod(ToDouble(@CONTENT4), 1000)))=2,LPad(ToString(Mod(ToDouble(@CONTENT4), 1000)),3 ,'0' ),
ToString(Mod(ToDouble(@CONTENT4), 1000)))),1,2 )

 

Code: 12.35

 

Round(ToDouble(12345)/1000,2)

 

Regards,

Anil

Avatar

Avatar
Validate 10
Level 2
Gene--O
Level 2

Likes

3 likes

Total Posts

76 posts

Correct Reply

0 solutions
Top badges earned
Validate 10
Validate 1
Boost 3
Boost 1
View profile

Avatar
Validate 10
Level 2
Gene--O
Level 2

Likes

3 likes

Total Posts

76 posts

Correct Reply

0 solutions
Top badges earned
Validate 10
Validate 1
Boost 3
Boost 1
View profile
Gene--O
Level 2

08-01-2013

thank you thank you thank you thank you Francis!

I tried (in vain) to get the round function to work before. You're answer was correct!

have a wonderful day!

Gene-O

Avatar

Avatar
Validate 10
Level 2
Gene--O
Level 2

Likes

3 likes

Total Posts

76 posts

Correct Reply

0 solutions
Top badges earned
Validate 10
Validate 1
Boost 3
Boost 1
View profile

Avatar
Validate 10
Level 2
Gene--O
Level 2

Likes

3 likes

Total Posts

76 posts

Correct Reply

0 solutions
Top badges earned
Validate 10
Validate 1
Boost 3
Boost 1
View profile
Gene--O
Level 2

08-01-2013

Thanks for your reply!

However, I cannot download the sample. I get a message that says the file is damaged and cannot be downloaded.

Any other suggestions??

Gene-O

Avatar

Avatar
Coach
MVP
radzmar
MVP

Likes

394 likes

Total Posts

2,686 posts

Correct Reply

489 solutions
Top badges earned
Coach
Ignite 3
Ignite 1
Validate 1
Give Back 50
View profile

Avatar
Coach
MVP
radzmar
MVP

Likes

394 likes

Total Posts

2,686 posts

Correct Reply

489 solutions
Top badges earned
Coach
Ignite 3
Ignite 1
Validate 1
Give Back 50
View profile
radzmar
MVP

07-01-2013

Hi,

the decimal places are rounded by IEEE 754 standard.

See example 25.4 under the following link.

http://partners.adobe.com/public/developer/en/xml/xfa_spec_3_3.pdf#page=1056

You might overcome this by adding 0.001 to your result.

Such as

NumericField * .555 + 0.001