Just a heads up: On March 24, 2025, starting at 4:30pm CDT / 19:30 UTC, the site will be undergoing scheduled maintenance for a few hours. During this time, the site might be unavailable for a short while. Thanks for your patience.
×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?
Anyone know how to make it so that it does detect the value or at least that if it detects 0 that it can remove the value?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.