Filter issues by field via javascript calculated field

Goal:
To filter all stories / epics / tasks / subtasks / umbrella tasks / … by field Development (field is empty or contains information about builds, pull requests, commits, etc …). End goal to get only those tickets, where “Development” field != “{}”.

Current attempts
I found the name of this field.

I did this simple implementation (check attached screenshot).

When I add this dimension to “Pages” - it shows the only value “1” and it still returns all tickets with empty and filled “Development” field. Could you provide any advice please? I assume this should be easier, than I think

Hi @GavinBelson,

​Welcome to the eazyBI community!

​JQL considers {} an empty set. Although the empty set might visually be represented as “{}” in the JSON data, the strict equality will not consider the string “{}” for being an empty set.
​However, the empty set is also considered a false-like “falsy” value in JS. Therefore, you might re-write the expression to return 1 for non-empty values and 0 for the empty set.
​You might try the following JS code instead.

if (issue.fields.customfield_10000){
 return 1;}
else {
 return 0;}


​Regards,
​Oskars / support@eazyBI.com

Hey @oskars.laganovskis ,
Thank you for warm welcome and proposed solution! I tried this option and it returns similar result. Btw, I also tested this expression via embedded editor and both solution behave differently (yours and mine) against different tickets (with development field empty and opposite…)
1

But anyway, both options return same result as at the screenshot :slight_smile:

P.s Yes, I did re-import.

@GavinBelson,

Integer type dimensions always get the (none) member added.
If you want to explicitly have only 0 and 1 values and do not plan to use this field as a measure, you might use the data type “string” for the dimension.

You might also add the check on .length attribute of the customfield data to make sure if the JSON object is populated or not.
​Please note - the return statements are swapped compared to your initial expression.
​The updated expression might then be as follows.

if (issue.fields.customfield_10000 && issue.fields.customfield_10000.length>0) {
​ return 1;}
​ else
​ {return 0;}​

Regards,
Oskars / support@eazyBI.com