Should a date filter in a search use WITHIN or BET...
# ask-stanley-ai
a
Should a date filter in a search use WITHIN or BETWEEN operator?
c
AI generated answer (using internal Slack threads):
The choice between using the WITHIN or BETWEEN operator in a date filter in a search depends on the specific requirements of your search. The WITHIN operator is used when you want to find records that fall within a specific date range. This operator requires both a "from" and "to" date to define the range. If you leave a WITHIN operator open on the "from" then it changes it in the UI to an "on or before" and your UI run will respect this change. However, on the server side it doesn't do this same thing and your dataset will be different. So, it's recommended to always provide both the "from" and "to" dates when using the WITHIN operator. On the other hand, the BETWEEN operator is used when you want to compare a date to two other dates and determine if it falls between them. For example, you can use the BETWEEN operator to find records where the created date is between Friday at 6:00 pm and Sunday at 6:00 pm. In a saved search formula, if you want to get the latest between two date fields, you can use a CASE statement. For example,
CASE WHEN {date1} > {date2} THEN {date1} ELSE {date2} END
. ****** Disclaimer: This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes. ******
Slack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.824401855
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.82232666
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.813903689
Please provide your feedback on this answer.