Need a special offer?Find out if your project fits.
+

When filtering by datetime dimensions only date time filter is supported.

Answered
Janez asked on September 5, 2023

When filtering by datetime dimensions, we have the option of filtering only by date.
Filtering by date and time is needed.
 

6 answers

Public
Solomiia Andrusiv Solomiia Andrusiv Flexmonster September 6, 2023

Hello, Janez!
 
Thank you for contacting us.
 
Kindly note that you can add the time filter to your custom filtering pop-up by using a couple of Flexmonster API calls.
 
Please find the brief description of the approach below:
1. Get all the timestamps from the initial data using getMembers() API call:

const timestamps = pivot.getMembers("Date")
                        .map(d =>parseInt(d.uniqueName.match(/\d+/)[0], 10));

2. Convert timestamps to the JavaScript Date object:

const date = new Date(timestamp);

3. Get the time from the created object using date.getHours() function and compare it with the time selected in the filter.
4. After comparing, apply the filter using our setFilter() API call:

pivot.setFilter("Date", {
    members: filteredTimestamps.map(t => "date.[" + t + "]")
})

We have prepared a JSFiddle sample to illustrate the idea: https://jsfiddle.net/flexmonster/sgjnkp92/.
Here, we are filtering all the timestamps with the datetime greater than 2023.09.06 10:00:00 AM.
 
Hope you will find our answer helpful.
Please let us know if the suggested approach works for your case.
 
Kind regards,
Solomiia

Public
Janez September 11, 2023

Hi,
Thank you for your response, but I believe there may have been a misunderstanding.
In the attached screenshot, the yellow highlight indicates where we would like to have an option to include time as a filter.
Could be so kind to ask dev team to add this feture? In screen shoot Time should be written on not Date
Janez

Public
Solomiia Andrusiv Solomiia Andrusiv Flexmonster September 13, 2023

Hello, Janez!
 
Thank you for your response.
 
We kindly recommend creating a custom filter pop-up to add the time filter to the datetime field.
You can find a step-by-step guide on how to create a custom filter in the following thread: https://www.flexmonster.com/question/how-to-use-custom-labels-for-filter-items/.
 
Hope you will find our answer helpful.
Feel free to reach out to us in case of any further questions.
 
Kind regards,
Solomiia

Public
Solomiia Andrusiv Solomiia Andrusiv Flexmonster September 21, 2023

Hello, Janez!

Hope you are having a great week.

Our team is wondering if you had a chance to look through the provided thread. Could you please let us know if there are any further questions about adding a custom filter pop-up?

Looking forward to hearing from you.

Kind regards,
Solomiia

Public
Janez September 22, 2023

Hello,
Your suggested solution could work but will add aditional complexity to the our solution that we don't want.
On the other hand I belive that your dev team doesn't have much work to add this to standard solution.
Could you be so kind to ask them if they could add this to your product?
Janez

Public
Solomiia Andrusiv Solomiia Andrusiv Flexmonster September 22, 2023

Hello, Janez!
 
Thank you for your response.
 
We have added the request for time filter UI control in the Filter pop-up to our clients' wishlist.
Our team will notify you about any updates on the matter.
 
Feel free to contact us if any other questions arise.
 
Kind regards,
Solomiia

Please login or Register to Submit Answer