Filtering GravityExport with conditional logic and relative dates
When setting up GravityExport to export entries based on date ranges using conditional logic, you may encounter two issues:
- Conditional logic not filtering entries correctly when added directly to a Save feed
- Relative date formats (like โlast day of last yearโ) not working as expected
This guide explains the workaround to filter entries by date using GravityExport Filter feeds.
The problem #
Issue 1: Conditional logic in Save feeds
When you add conditional logic directly to a GravityExport Save feed, it may not filter entries correctly. This is a known bug that is being addressed by our development team.
Issue 2: Relative date format behavior
PHP handles relative dates in unexpected ways. For example, using last day of last year as a relative date may not generate the correct date value. Learn more about PHPโs relative date formats.
The workaround: Using Filter feeds #
You can work around both issues by creating a separate GravityExport Filter feed with valid relative date logic, then applying that filter to your Save feed.
Step 1: Create a Filter feed
- Go to Forms > hover over your form and click Settings
- Click the GravityExport tab
- Click Add New under the Filter Sets section
- Give your filter a descriptive name (e.g., โFilter Current Year Entriesโ)
- Set up your date filtering logic:
- In Filter Settings, click Add Condition
- Select Entry Date from the first dropdown
- Choose is after as the operator
- Enter
first day of this yearas the value
Screenshot showing the Filter Sets configuration with Entry Date is after โfirst day of this yearโ - Click Update Settings to save the filter
Tip: Using
first day of this yearis more reliable thanlast day of last yeardue to how PHP processes relative date formats.
Step 2: Apply the filter to your Save feed
Navigate to your Save feed settings
In the Conditional Logic section, find the Filter Sets dropdown
Select the Filter feed you just created (e.g., โFilter Current Year Entriesโ)
Screenshot showing the Save feed with Filter Sets dropdown selecting โFilter Current Year Entriesโ Click Update Settings to save your changes
Step 3: Test the export
Create a new entry in your form to trigger an automatic export (if configured), or manually download the export file to verify that only entries from the current year are included.
Understanding Entry Date vs.ย database date format #
What โEntry Dateโ means
When you select Entry Date in GravityExport filter settings, youโre filtering based on the date_created column in the Gravity Forms entries database table.
Date storage format in Gravity Forms
Gravity Forms stores dates in the database in yyyy-mm-dd format, regardless of how dates are displayed on the front end. This is important to know if youโre:
- Adding entries programmatically
- Importing entries from external sources
- Troubleshooting date filtering issues
If entries were added outside the standard form submission process using a different date format, this could cause unexpected filtering behavior.
Alternative date filtering options #
Filtering by a specific date range
To filter entries from a specific date range (e.g., September through December 2024):
- Add a condition: Entry Date is after
2024-09-01 - Click Add Condition again
- Select Entry Date is before
2025-01-01 - Ensure the Match setting is set to All (so both conditions must be true)
Filtering using merge tags
You can also use merge tags for dynamic date filtering:
{today}– Current date{tomorrow}– Tomorrowโs date{yesterday}– Yesterdayโs date
Note: While merge tags like
{today}work in some contexts, using relative date phrases like โfirst day of this yearโ in Filter feeds provides more reliable results for year-based filtering.
Related documentation #
Still having issues? #
If youโre still experiencing problems with date filtering in GravityExport, please contact our support team and provide:
- The name of the form youโre working with
- Examples of entries that should or should not appear in your export
- Your Filter feed and Save feed configurations (screenshots are helpful)
We may ask you to grant us temporary access to your site so we can investigate the issue directly.