# Filter issues by field via javascript calculated field

**URL:** <https://community.eazybi.com/t/filter-issues-by-field-via-javascript-calculated-field/11339>\
**Category:** Questions & Answers\
**Tags:** eazybi\
**Created:** [December 22, 2022, 5:04pm UTC](https://community.eazybi.com/t/filter-issues-by-field-via-javascript-calculated-field/11339 "2022-12-22T17:04:15Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![GavinBelson](https://community.eazybi.com/letter_avatar_proxy/v4/letter/g/8e8cbc/32.png) [@GavinBelson](https://community.eazybi.com/u/GavinBelson)\
**Post date:** [December 22, 2022, 5:04pm UTC](https://community.eazybi.com/t/filter-issues-by-field-via-javascript-calculated-field/11339/1 "2022-12-22T17:04:15Z")

</div>

**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).

 ![image](https://community.eazybi.com/uploads/default/original/2X/b/bea9a380c97653d43f523ddae5c6b8575edc4d58.png)

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

---

<div class="post-metadata">

**Author:** ![oskars.laganovskis](https://community.eazybi.com/user_avatar/community.eazybi.com/oskars.laganovskis/32/5902_2.png) [@oskars.laganovskis](https://community.eazybi.com/u/oskars.laganovskis)\
**Post date:** [December 29, 2022, 9:16am UTC](https://community.eazybi.com/t/filter-issues-by-field-via-javascript-calculated-field/11339/2 "2022-12-29T09:16:18Z")

</div>

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.

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

```

​  
​Regards,  
​Oskars / [support@eazyBI.com](mailto:support@eazyBI.com)

---

<div class="post-metadata">

**Author:** ![GavinBelson](https://community.eazybi.com/letter_avatar_proxy/v4/letter/g/8e8cbc/32.png) [@GavinBelson](https://community.eazybi.com/u/GavinBelson)\
**Post date:** [December 29, 2022, 10:31am UTC](https://community.eazybi.com/t/filter-issues-by-field-via-javascript-calculated-field/11339/3 "2022-12-29T10:31:02Z")

</div>

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](https://community.eazybi.com/uploads/default/original/2X/5/56ca63b0fbbb71be1f0e8208d9035519d806b77c.gif)

---

<div class="post-metadata">

**Author:** ![GavinBelson](https://community.eazybi.com/letter_avatar_proxy/v4/letter/g/8e8cbc/32.png) [@GavinBelson](https://community.eazybi.com/u/GavinBelson)\
**Post date:** [December 29, 2022, 10:31am UTC](https://community.eazybi.com/t/filter-issues-by-field-via-javascript-calculated-field/11339/4 "2022-12-29T10:31:55Z")

</div>

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

 ![image](https://community.eazybi.com/uploads/default/original/2X/8/860b5a6adcdd2a653f4b859ea30050464639ea02.jpeg)

P.s Yes, I did re-import.

---

<div class="post-metadata">

**Author:** ![oskars.laganovskis](https://community.eazybi.com/user_avatar/community.eazybi.com/oskars.laganovskis/32/5902_2.png) [@oskars.laganovskis](https://community.eazybi.com/u/oskars.laganovskis)\
**Post date:** [December 29, 2022, 12:37pm UTC](https://community.eazybi.com/t/filter-issues-by-field-via-javascript-calculated-field/11339/5 "2022-12-29T12:37:37Z")

</div>

@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.  
​

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

```

Regards,  
Oskars / [support@eazyBI.com](mailto:support@eazyBI.com)
