Filter on Date Ranges

A case worker for a technical support team needs to keep track of assigned multiple cases—and make sure they are dealt with in a timely fashion. In this workflow it can be handy to check when the case file was created and when that file was last modified.

With Skuid, it’s easy to create a filter that can do this using the Date Range filter. (It’s also possible to filter on dates using the Select option filter type.)

Use the examples below as templates to build your own filters!

Assumptions

Note

The first two examples below assume a Skuid page with:

  • a functioning model on an object that collects information about service cases. (In this example, we used Salesforce’s Cases object.)

  • a Table component on that model with fields for …

    • associated account (if any), i.e. AccountID
    • Case Number and Case Type
    • Created Date and Closed Date
    • Owner ID

If using a different data source, the field names indicated may be different.

Date Range Filter/Auto-generated Conditions

Using the pre-configured Date range filter is a fast and easy way to let the user filter for dates. Select a date or datetime field and choose to have Skuid automatically generate the conditions.

The goal? A filter that allows users to fill in “start date” and “end date,” then filter for all records within that range. This lets the case worker look for cases that were created on a specific day, or those created within a certain week, or month—and determine if any are still pending.

image1

Build the filter [[]]

Create a filter with autogenerated conditions to display records that fit within a user-entered set of “start” and “end” date values.

On the Table component, click Add feature > Table filter, then configure the filter:

  • Filter type: Date Range
  • Filter method: Server
  • Condition source: Automatically
  • Date/datetime field: The field with the amount of the opportunity (in this case, the Case object’s CreatedDate field.)
  • Show label above filter: Yes, use Custom label.
  • Filter label: Date Range

Date Range Filter/Builder-generated Conditions

Another way to let the support worker identify overlooked cases is to filter the date the record was created against that time it was modified. To do this, use builder-configured conditions with the Date range filter type.

The goal? A filter that limits the search to a range of time that begins with the date the record was created and ends with the last time the record was opened.

image3

Create model conditions [[]]

Create a pair of conditions to represent the date range from the creation of the case (“created date”) to the last time the record had any user interaction (“last modified date”). Click add to create a condition:

  • Field: Use a datetime field (in this case, the Opportunity object’s CreatedDate field.)

  • Operator: >= (Greater than/equal to).

  • Value: Leave blank

  • State:

    • Condition state: Filterable default off. (Skuid will automatically generate a name for the filter.)

Click add to add a second condition:

  • Field: Use a datetime field (in this case, the opportunity object’s LastModifiedDate field.)

  • Operator: =< (Less than/equal to).

  • Value: Leave blank

  • State:

    • Condition state: Filterable default off. (Skuid will automatically generate a name for the filter.)

Build the filter [[]]

Now, create a filter using the newly-created conditions. Users enter a “start date” (which is associated with the date the record was created, as defined by the first condition) and an “end date” (which is associated with the last time the record was opened or edited, as defined by the second condition)

On the Table component, click Add feature > Table filter, then configure the filter:

  • Filter type: Date range
  • Filter method: Server
  • Pick options and conditions: Manually
  • Filter label: Case Activity Span
  • (Start of range) Model condition to affect: The “created date” condition created in the previous steps.
  • (End of range) Model condition to affect: The “last modified date” condition created in the previous steps.

Other Ways to Filter on Dates

The two previous examples use the pre-configured Date range filter type to build a filter that limited records by a date or datetime value, based on date range start and end points entered by the user.

But there’s another way to filter dates, one that allows the builder a fixed set of dates from a dropdown menu. To create this type of date filter, use a Select option filter and standard date strings. To learn more, see Use Select option to Filter on Date Ranges.