Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

If else statement for old tickets without the field and new tickets with field -Jira Script Field

bSte October 9, 2018
def total = ((bvInt + tcInt + rrInt + svInt) / sizeInt) * 100;
def totalNull = ((bvInt + tcInt + rrInt) / sizeInt) * 100;
def result;

if(svValue!=null || "None" || "Nil"){
return total;
} else {
return totalNull;
}

1 answer

0 votes
Moga
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 16, 2018

Hi there,

It would be good if you can indicate how we can help you with this question. Does the script gives you an error or it is not doing the right calculation?

Cheers,
Mogavenasan

bSte November 29, 2018

Here is what ended up working: 

 

if (bValue == "null") {bValue = "0"};
if (tValue == "null") {tValue = "0"};
if (rValue == "null") {rValue = "0"};
if (sValue == "null") {sValue = "0"};
if (svValue == "null") {svValue = "0"};

double sizeInt = Integer.parseInt(sValue);
double rInt = Integer.parseInt(rValue);
double tInt = Integer.parseInt(tValue);
double bInt = Integer.parseInt(bValue);
double svInt = Integer.parseInt(svValue);

def total = 0
if (sizeInt == 0) {total = 0}
else {total = ((bInt + tInt + rInt + sInt) / sizeInt) * 100};

return total

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events