Hi,
I have 3 numeric custom fields. I have used each of the values from these fields to perform a calculation and render the value in a 4th read only text field (I'm unaware of a any numeric read only custom field so needs to be text). I have already created the necessary logic to using the following automation rule:
{{#=}}({{issue.fields.Custom Field 1}} * 100 + {{issue.fields.Custom Field 2}} * 110 + {{issue.fields.SCustom Field 3}} * 105) * 1.15 * 1.1{{/}}
I wish to format this value to have a 1000 separators as the value is currently hard to read e.g. instead of 1000000 it should render on screen as 1,000,000
I see that you can apply the format() option to a specific custom field (e.g. https://support.atlassian.com/cloud-automation/docs/jira-smart-values-math-expressions/) value but how can I apply it to a group of custom fields that are calculated into one value?
Thanks
Mike
Hi @Mike Low
You could try the smart value asNumber.
This takes a string, and converts it to a number if possible.
{{issue.Custom Field 4.asNumber}}
Thanks @Marc - Devoteam .
At what point in the rule would you place this?
In the rule I've created the Custom field 4 is not included in the calculation. It is merely selected as the field to be calculated. See below the highlighted drop down is the Custom Field 4
I tried adding a THEN component at the end of the rule = {{issue.Custom Field 4.asNumber}} but this just overrides the calculation that was made with NULL
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Mike Low
This would require 2 extra actions in your rule I think.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks @Marc - Devoteam . I tried the below (adding those 2 components after the calculation components have run but unfortunately the calculated data is still getting cleared.
I can confirm that if those 2 components are not in place the field calculates and renders successfully.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Mike Low
Could you set the customfieldId instead on the name?
example: {{issue.customfield_10101.asNumber}}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks @Marc - Devoteam .
I tried this and it unfortunately didn't work. Note I did realise that my custom field 4 is not purely numeric as I prefix it with a currency value of "R". I removed this from the calculation so that the field would be purely numeric but unfortunately the field is still being overwritten with NULL when those 2 components are added to the rule.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Mike Low
If you would place the re-fetch and edit action in the if and else statements.
I think now te re-fetch is done before the edit action in the if or else statement.
If this is not a working solution, you might need to reach out to Atlassian Support or I will try to mock this up on my instance, but I will need time to do so.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks @Marc - Devoteam .
I added the 2 components within the if statement as follows:
The good news is that it does render the number and not NULL now. However, it renders the same as if the 2 components were not there as well so does not format the number to have 1,000 separator e.g.
I don't want to take too much of your time so don't mind passing this query onto Atlassian if you prefer.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
HI @Mike Low
I did a good re-read of the documentation on smart values and found a similar issue on the community.
Can you try the following, use the smart-value;
{{issue.Change Cost.asNumber.format("###,###,###.00")}}
This might just work, if not, then it onlly applies to number fields.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Bingo! This worked like a charm when running in the if statement, with the re-fetch component and the edit field component using that latest smart value you provided. Thank you @Marc - Devoteam !!!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.