Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

how to convert original estimate to number

I have a formula that i must multiply a custom field number by the original estimate , i find problem because the original estimate have not the number type 

 

so i need to convert it.

 

Regards

 

2 answers

0 votes

The original estimate is not a "duration", it's a number.  Measured in milliseconds, so if you want it in minutes, you need to convert it with

issue.getOriginalEstimate() / 60,000

For hours, divide again by 60.  For days/weeks though, again divide, but remember to take into account your time tracking settings (1 day is 8 hours, not 24)

Note - that call above should return a long number if I remember right, but I think it's ok to multiply a long with a double?

Hi, how to do the opposite of that calculation ? 

I suppose that i have a number, and i want to put it in the original estimate field 

How are you putting it in?  Code?  Typing?  REST call?

using the smart values

{{#math}}{{issue.customField_10061}}+{{issue.customField_10062}}+{{issue.customField_10063}}+{{issue.customField_10079}}{{/math}}

 

it works when the sum is an integer, but doesnt when it's real 

ex : 1 + 1 + 3 + 2   shows "1d" in the original estimate 

or 1.5 + 1.5 + 2 + 1 shows 6h 

but when i put 1.5 + 1 + 2 + 3 the rule doesnt execute 

I don't use smart values, but that looks like a bug in it.

I tried to use JSON,

here is my script 

{
"fields": {
"timetracking": {
"originalEstimate": "issue.customField_10087"

}
}
}

 

where the customfield 10087 is a text field and i've entered as an example : "1h 30m" , but still doesnt work :s 

Could you enter it in milliseconds, as that's the storage format?

4.5 gives me this result when i do the conversion to milis 

image.png

Ah, the API is not listening in milliseconds.  Have you tried plain 4.5?

What do you mean by plain 4.5 ?

Literally feed it a number.  The rest API only takes numeric data (I thought it was milliseconds because that's what I see in code elsewhere).  4.5 is likely to be 4.5 hours, but you'll see that when you look again at the issue.  Whatever unit it is expecting, it will be consistent.

when i add 0.5 to 4.5, it's working and showing 5hours, also if i add 2.5 to 4.5 it shows 1d (as i've set 1day=7hours in the Timetracking settings). 

However, i want to have the 4.5 or whateaver (1.75 hours ...etc.) . But it's frustrating because it's not working! 

Is it a bug ??? do i have to report it ? 

Thank you again for you answers, fixing this problem will have an impact in our Jira projects. 

Like Luis Alejandro De Peña likes this

Are you saying decimal values are not working?

Yes exactly. 

That is very odd, it works for me.

I think, yes, you may need to report it as a bug.

Could you send me a screenshot of how did you manage to make it works ???

Thank you 

I'm not doing anything differently to you.  Hitting the rest endpoint with a curl backed json payload.

I'm i doing something wrong in this code ??? 

 

{
"fields": {
"timetracking": {
"originalEstimate": "issue.customField_10061+issue.customField_10062+issue.customField_10063+issue.customField_10079"

}
}
}

Yes, you need to give it a number, not a string of custom field names.

could you please give me an example ? 

{
"fields": {
"timetracking": {
"originalEstimate": "4.5"}
}
}

Works for me.

Me too,  but is there a way To parse the value of a cutom field.  ???

Yes, your code will need to ask Jira for the data for the fields, do the calculations you need and then send back a number.

Ok, i'll try this, but do you have any documentation ? i'm not very familiar with JSON in JIRA, just starting. 

Hello Assia,

can you solve this issues?

i need this feature and don't know how to configure it.

can you help me if resolved it?

 

thank's

Azadeh

I'm having the same issue ,,,, any help in this regard? When my custom field has a value of 4.5 it calculates as 45h! (number field and I pass the value as smart value with "h").

you may want to try 4,5

Can you Give Some Example cant able to understand properly

@Ramesh 

my formula is 

 

result = Original estimation * double(avp) 

original estimation type is duration 

avp is a custom field with type double.

 

Regards

Suggest an answer

Log in or Sign up to answer
TAGS

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you