We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

{exp:channel:entries search:duration_field="<= 40 minutes"}?

How Do I?

shbchk's avatar
shbchk
12 posts
4 years ago
shbchk's avatar shbchk

Is there a way to use duration field with search parameter of {exp:channel:entries}? How to get entries where total minutes in duration field <= 40?

       
Robin Sowell's avatar
Robin Sowell
13,158 posts
4 years ago
Robin Sowell's avatar Robin Sowell

Ah- that’s a clever idea, but I can’t think of a solid way to do it. The problem is, the duration field is a string. So even if you specified the time only in minutes (for example) 6 is going to be be bigger than 52. (If all your numbers were going to be 2 digits or something, you could do it. I’m assuming they aren’t. See here for details: https://www.copterlabs.com/natural-sorting-in-mysql/)

While I vastly prefer the duration field for display purposes, if searching/ordering by a number is critical, you’d need to go with say a text field set to ‘integer’ type.

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.