How do I remove the thousands separator from a field value used in a formula?

Dave Stillwell November 5, 2024

I am trying to use automation to update a Total Cost Field using the formula:

{{#=}}{{lookupAsset.attributes.cost}} * {{issue.Number of Units}}{{/}}

I am getting an error Unexpected comma at character position 1: 1,577.66 * 2.0.

This is because the Cost value associated with Asset has a comma (I verified by removing the comma from the cost which allows the formula to work).

So, in order to not have to update all my costs to remove the comma.  Is there a way to modify the formula to ignore the comma?

1 answer

1 accepted

1 vote
Answer accepted
Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 5, 2024

Hi @Dave Stillwell 

You could try using the text functions remove() or replace() to get rid of the comma before it used: https://confluence.atlassian.com/automation/jira-smart-values-text-fields-993924863.html

For example, perhaps try this:

{{#=}}{{lookupAsset.attributes.cost.remove(",")}} * {{issue.Number of Units}}{{/}}

If that does not work, you may need to capture / save the asset value in a Created Variable first, and then perform the remove().

Kind regards,
Bill

Dave Stillwell November 6, 2024

Solution works!  Thank you for the help

Like Bill Sheboy likes this

Suggest an answer

Log in or Sign up to answer