Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
It's not possible to filter a view by an hms field, for example duration. Say I create a view where one of the fields is an hms field with duration in the format of h:mm:ss. I then want to filter by all nodes with less than or greater than the duration that I enter.
Any solution to this?
Comments
Comment #1
Frans CreditAttribution: Frans commentedhmm yeah you can, but you must enter the duration in seconds. Not so fancy :)
I have no quick fix for this, probably need to write a views plugin.
Comment #2
westis CreditAttribution: westis commentedA views plugin would be great indeed. This is a functionality that I really need, but I'm not well-traversed enough with programming to know how to do.
Comment #3
kerberos CreditAttribution: kerberos commentedUntil such a Views plugin comes, what I needed was a drop down with all the existing HMS values in the database. The following snippet accomplishes that (you need to adjust to your module and tables/field names. Clear the cache for it to work.
I hope you find this helpful!
-Daniel
Dragonvale Breeding Guide
Comment #4
Frans CreditAttribution: Frans commentedSee release 7.x-1.2 https://drupal.org/node/2047187
Comment #6
westis CreditAttribution: westis commentedThanks for fixing this! However, when exposing the operand, there are three fields that always display regardless of which operand I choose: Value, Min and Max. That is a bit confusing since if I choose "Is Between", then I need to use the latter two fields, whereas if I choose something like "Is Less Than", I must enter the one value in the first field but leave the other two.
Comment #7
Frans CreditAttribution: Frans commentedIs this different from other numeric fields (other integer fields) in Views?
The only difference with the integer field is that the display and input is different; the code from the integer field is inherited.