I have a field that calculates the number of days a date has changed in the last 7 days. I am then exporting the results to a jira filter to only pick up days that have changed. I want to exclude any fields that are empty or that have a value of 0. Excluding the fields based on and empty field is working fine but excluding fields based on a value of 0 is not working. Below is my formula and query.
def history = issue.getFieldHistory("Changed Due Date")
if (!history.size())
return null; //changed due date is still empty
def lastChange = history.last()
if (!lastChange.from && lastChange.created.after(new Date() - 7) && issue.get("Original Due Date")) //this is the first time the changed due date is set
return issue.get("Original Due Date") - Date.parse("yyyy-MM-dd",lastChange.to);
if (!lastChange.from || !lastChange.to || lastChange.created.before(new Date() - 7))
return null;
return Date.parse("yyyy-MM-dd",lastChange.from) - Date.parse("yyyy-MM-dd",lastChange.to);The calculated field is a calculated scripted number field using the JMCF fields. The field name is called "Weekly Variance".
The search that I am doing is as follows
project = Goal AND "Goal Type" = "Milestone (Launch)" AND "Goal Level" in ("P&S") AND statusCategory in ("In Progress") AND "Goal Date Type" != Ambition AND "Changed Due Date" is not EMPTY AND ("Weekly Variance" is not EMPTY or "Weekly Variance" != 0)Everything in the query is working except for the last part "Weekly Variance" != 0
If it isn't possible to detect history values in the JQL, I would love having some help on clearing the field if the value is 0 because I know the "Weekly Variance" is not EMPTY portion of the query is working. But if there is a way to get the jql to work at detecting the 0 value then that would work as well. Anyone know how to do this?