Jump to content
  • 0

Filter results by weekend in timestamp


jboder2

Question

Hi, I need to filter results of a report to only those reservations placed on a saturday or sunday. i use a timestamp field which can be formatted the long way for the days. is there a script that can filter our all other days and only show orders containing "Saturday" or "Sunday"?

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

Hello @jboder2,

Basically, we can use a View to filter records https://howto.caspio.com/tables-and-views/what-are-views/creating-a-view-to-filter-data/

In this example, we need only those records where the date in Timestamp is "Saturday" or "Sunday".

My idea is to retrieve the day of the week to use it for filtering records. 

Weekday is not supported in the Formula field:

bQmrkJl.png

Therefore, we can use Triggered Actions or Tasks to populate the field with the day of the week. 

1) I added the week_day field to the table (data type is Integer) and created this Trigger:


gnGNxo1.png


2) If you need to update this field for existing records, then you may use a Task. Because Trigger works on Insert and will populate the field for the newly created records. 

RKjOz7W.png

3) In the View, Criteria should be the following:

1hmjSfQ.png

In SQL, for the days of the week, 1 stands for Sunday, 7 - for Saturday.

4) Report can be built using this View as a data source.

Hope this solution works for you.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...