You are viewing limited content. For full access, please sign in.

Question

Question

getFieldValues is not retrieving the full value when using a currency field?

asked on May 14

I am using the modern designer, and when using the getFieldValues function to retrieve the field value from a currency field, it is only returning the whole dollar amount. If I enter 100.50, then it returns 100.5. Any ideas?

0 0

Answer

SELECTED ANSWER
replied on May 14

I don't think you need the rounding step since the math just cancels out.

If the value is numeric CurrencyField.toFixed(2) alone should be sufficient.

The reason for this behavior is that Currency is a "masked" field, meaning it stores a numeric value behind the scenes so they can be evaluated numerically in calculations, gateway conditions, etc.

However, the value is displayed as formatted text because leading/trailing zeros, commas, etc., are not valid for true numeric types.

100.5 and 1000.5 = numeric

'100.50' and '1,000.50' = text/string

 

2 0

Replies

replied on May 14

I was able to resolve this by adding the following:

(Math.round(CurrencyField * 100) / 100).toFixed(2);

 

0 0
SELECTED ANSWER
replied on May 14

I don't think you need the rounding step since the math just cancels out.

If the value is numeric CurrencyField.toFixed(2) alone should be sufficient.

The reason for this behavior is that Currency is a "masked" field, meaning it stores a numeric value behind the scenes so they can be evaluated numerically in calculations, gateway conditions, etc.

However, the value is displayed as formatted text because leading/trailing zeros, commas, etc., are not valid for true numeric types.

100.5 and 1000.5 = numeric

'100.50' and '1,000.50' = text/string

 

2 0
replied on May 14

Thanks for the explanation!

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.