Use Select option to Filter on Date Ranges¶
In Filter on Date Ranges, the examples uses the pre-configured Date range filter type limit records. But there’s another way to filter dates, one that allows the builder a fixed set of dates from a dropdown menu.
For example, what if a manager of the tech support team wanted to filter cases by the last time they were modified—that is, the last time anyone on the team worked with the case—based on a set of parameters:
- Worked on today
- Worked on this week
- Worked on during the last week
- Worked on sometime this month
To create this type of date filter, use a Select option filter and standard date strings.
The goal? A filter that allows the user to select from a drop down of pre-selected date options.
Assumptions¶
Note
The example below assumes a Skuid page with:
a functioning model on an object that collects information about potential leads (In this example, we used Salesforce’s Opportunity object).
a table on that model with fields for …
- Name (of lead)
- associated account (if any): AccountID
- Amount
- Created Date and Last Modified Date
- Owner ID
If using a different data source, the field names indicated may be different.
Create model conditions [[]]¶
In the model, under Conditions, click
to add a new condition and configure this condition for the start date of the first date range (e.g. $1,000):Field: Use the Last Modified Date datetime field
Operator: =
Value: Leave blank
State:
- Condition state: Filterable default off. (Skuid will automatically generate a name for the filter.)
Build the filter [[]]¶
On the Table component, click Add feature > Table filter, then configure the filter:
- Filter type: Select option
- Filter method: Server
- Pick options and condition: Manually
- Filter label: Last Modified Date
- Model condition to affect: The one created in the previous step
- Create “None Selected” option: Checked
- “None Selected” option text: Last Input
- Display as: Dropdown
Add the filter source¶
On the Last Input filter, click the Sources tab. Click
Add option source, then configure:- Source type: Manual
Choose filter options¶
On the Source: Manual option source, click
Add option to create an option for the first choice to be listed in the filter:- Which conditions will this source’s option affect?: Affect the default condition.
- Label: Today
- Value: TODAY
Repeat the step above to add three addition Filter Options:
- This Week (value string: THIS_WEEK)
- Last Week (value string: LAST_WEEK)
- This Month (value string: THIS_MONTH)
Learn more about Datetime formula functions.