text formula question

Sonya S_ January 13, 2015

hi,  

I want to create an identification formula, 

One Calculated number field (ID:12002) is created and works well.

I want to convert the value into text as 

if value is null then null

if value >4 then "Over 4 wks"

if value >2 then "2~4 wks"

if value >0 then "0~2 wks"

 

I tried to use below 2 method, but failed

<!-- @@Formula:
Integer i = issue.get("customfield_12002");
if (i==null) return null;
if (i > 4) return "Over 4 wks";
if (i > 2) return "2~4 wks";
return "0~2 wks";
-->

or 

<!-- @@Formula:
Integer i = issue.get("customfield_12002");
if (i==null) return null;
else if (i > 4) return "Over 4 wks";
else if (i > 2) return "2~4 wks";
else return "0~2 wks";
-->

 

 

I refered document as below, however, it doesn't work, please help, thank you, 

Quick reply, before you post your question on Answers: 

I assume you already have a calculated number field. Let's say its ID is 12345, hence its name is "customfield_12345".

In your Calculated Text Field, you would do something like:

 

<!-- @@Formula:
Integer i = issue.get("customfield_12345");
if (i==nullreturn null;
if (i==0return "low";
if (i==2 || i==3return "medium";
return "high";
-->

 

 

1 answer

0 votes
Sonya S_ January 13, 2015

I modified the code as below, then it works

<!-- @@Formula:
if (issue.get("customfield_12002")==null) return null;
else if (issue.get("customfield_12002") > 4) return "Over 4 wks";
else if (issue.get("customfield_12002") > 2) return "2~4 wks";
else return "0~2 wks";
-->

 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events