# graphQL: Add ability to filter by a range (Date/Numeric fields)

**URL:** <https://community.fibery.io/t/graphql-add-ability-to-filter-by-a-range-date-numeric-fields/5963>\
**Category:** Ideas & Features\
**Tags:** graphql\
**Created:** [March 12, 2024, 1:51am UTC](https://community.fibery.io/t/graphql-add-ability-to-filter-by-a-range-date-numeric-fields/5963 "2024-03-12T01:51:28Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Matt\_Blais](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/matt_blais/32/1464_2.png) [@Matt\_Blais](https://community.fibery.io/u/Matt_Blais)\
**Post date:** [March 12, 2024, 1:51am UTC](https://community.fibery.io/t/graphql-add-ability-to-filter-by-a-range-date-numeric-fields/5963/1 "2024-03-12T01:51:28Z")

</div>

It would be useful if graphQL queries could filter for a Date field in a specific range.

This would also be useful for Numeric fields.

This is a special case of the missing ability to specify compound conditions –  
_field_\>lowerBound AND _field_\<upperBound

---

<div class="post-metadata">

**Author:** ![Oleg](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/oleg/32/1887_2.png) [@Oleg](https://community.fibery.io/u/Oleg)\
**Post date:** [March 12, 2024, 9:48am UTC](https://community.fibery.io/t/graphql-add-ability-to-filter-by-a-range-date-numeric-fields/5963/2 "2024-03-12T09:48:55Z")

</div>

Hello, @Matt_Blais

It is possible. Find example below

```auto
{
  findReleases(releaseDate:{
	greater: "2023-10-01"
    less: "2023-10-31"
  })
  { 
    name
    releaseDate
  }
}

```

 ![image](https://us1.discourse-cdn.com/flex020/uploads/fibery/original/2X/8/82f5cc846b893002079088df2863e1c2083b46cb.png)

---

<div class="post-metadata">

**Author:** ![interr0bangr](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/interr0bangr/32/8089_2.png) [@interr0bangr](https://community.fibery.io/u/interr0bangr)\
**Post date:** [September 25, 2024, 1:13pm UTC](https://community.fibery.io/t/graphql-add-ability-to-filter-by-a-range-date-numeric-fields/5963/3 "2024-09-25T13:13:37Z")

</div>

@Oleg is there a way to reference today’s date in graphQL filter?

Like if I wanted to update your previous example to query all releases with a release date that fell in the last 7 days?

```auto
{
  findReleases(releaseDate:{
        less: Today - 7 days
  })
  { 
    name
    releaseDate
  }
}

```

---

<div class="post-metadata">

**Author:** ![Oleg](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/oleg/32/1887_2.png) [@Oleg](https://community.fibery.io/u/Oleg)\
**Post date:** [September 25, 2024, 1:28pm UTC](https://community.fibery.io/t/graphql-add-ability-to-filter-by-a-range-date-numeric-fields/5963/4 "2024-09-25T13:28:57Z")

</div>

Hello, @interr0bangr

Unfortunately it is not possible for now.

---

<div class="post-metadata">

**Author:** ![Matt\_Blais](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/matt_blais/32/1464_2.png) [@Matt\_Blais](https://community.fibery.io/u/Matt_Blais)\
**Post date:** [September 25, 2024, 5:15pm UTC](https://community.fibery.io/t/graphql-add-ability-to-filter-by-a-range-date-numeric-fields/5963/5 "2024-09-25T17:15:44Z")

</div>

@interr0bangr I access the graphQL API from bash scripts, and accomplish this like so:

```auto
...

local before=${before:-'3 months ago'}
before="dateRange: { end: {less: \"$(utcDate "$before")\" } }"
limit=${limit:+"limit: $limit"}
SPACE=REPORTS; QUERY='
    mutation {
        callStats(
            '$before' # exclude newer
            calls: { isEmpty: true }
            callsCount: { is: 0 }
            callsDurationMinutes: { is: 0 }
            orderBy: { dateRange: {start: ASC} }
            '$limit'
        )
        # Use executeAsBackgroundJob if receiving "The upstream server is timing out"
        # {executeAsBackgroundJob { jobId actions
            { delete {message} }
        # }}
    }'
total=0; CHECKDELAY=30
while :; do
    waitForFiberyBackend # Wait for Fibery backend (Formulas, linking, etc) to get caught up
    doQuery # call curl for $SPACE and $QUERY- sets $rc
    ((rc==7)) && continue # "Canceling statement due to statement timeout."
    ((deleted==0)) && break
    ((total+=deleted))
done
echo -e "FINISHED $jobName, TOTAL=$total" >&2

```

If you’re interested I can post the other parts of this system.

---

<div class="post-metadata">

**Author:** ![interr0bangr](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/interr0bangr/32/8089_2.png) [@interr0bangr](https://community.fibery.io/u/interr0bangr)\
**Post date:** [September 25, 2024, 5:26pm UTC](https://community.fibery.io/t/graphql-add-ability-to-filter-by-a-range-date-numeric-fields/5963/6 "2024-09-25T17:26:36Z")

</div>

Thanks @Matt_Blais but that’s way over my very-limited understanding of the api/scripts!

I just created a date helper formula on one of databases and then use that field in my script, which isn’t ideal but gets the job done. 🙂

---

<div class="post-metadata">

**Author:** ![Chr1sG](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/chr1sg/32/3941_2.png) [@Chr1sG](https://community.fibery.io/u/Chr1sG)\
**Post date:** [April 29, 2025, 11:14am UTC](https://community.fibery.io/t/graphql-add-ability-to-filter-by-a-range-date-numeric-fields/5963/7 "2025-04-29T11:14:33Z")

</div>


