We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 53699
    • 22 Posts
    Hi Team,
    How to use
    GetResources with tv date filter with specific month and year.

    Below code snippet is not working, tv name is EventDateTv
    [[getResources? 
    &parents=`12`
    &limit =`25`
     &includeTVs=`1`
     &processTVs=`1`  
    &tpl=`GetResultSearch_tpl`
    &tvFilters=`EventDateTv:strtotime>=1501587780`
    
    &debug=`true`
    &where=`[{"pagetitle:LIKE":"%event%"}]` ]]

    and below code is working.
    [[getResources? 
    &parents=`12`
    &limit =`25`
     &includeTVs=`1`
     &processTVs=`1`  
    &tpl=`GetResultSearch_tpl`
    &tvFilters=`EventDateTv==2017-08-01 17:13:00`
    &debug=`true`
    &where=`[{"pagetitle:LIKE":"%event%"}]` ]]

    How to modify tvFilters to search with month and year or can I use &where with tv

      • 3749
      • 24,544 Posts
      Try something like this:

      &tvFilters=`EventDateTV>>2017-08-01 17:13:0,EventDateTV<<2017-09-01 17:13:0`


      Something like this could also possibly work, and would be a lot more convenient:

      &tvFilters=`EventDateTV==2017-08`



      BTW, this is incorrect:

      &tvFilters=`EventDateTv:strtotime>=1501587780`


      1501587780 is already a timestamp. You'd want strftime: or date: to convert it to a human-readable date, which apparently is what TvFilters wants, but it would be faster just to send the human-readable date.
        Did I help you? Buy me a beer
        Get my Book: MODX:The Official Guide
        MODX info for everyone: http://bobsguides.com/modx.html
        My MODX Extras
        Bob's Guides is now hosted at A2 MODX Hosting
        • 53699
        • 22 Posts
        Thanks allot , I will try to in-corporate them. Have a great day
          • 36570
          • 12 Posts
          Just if anybody else need the solution how to filter resources based on date TV...
          Here is an exmaple, that works with pdoResources:

          [ul]
          [li]
          &tvFilters=`nameOfDateTV>>[[!getDate:date=`%Y-%m`]]`
          : list only resources with TV value, where month is greater than current moth[/li]
          [li]
          &tvFilters=`nameOfDateTV>>[[!getDate:date=`%Y-%m-%d`]]`
          : list only resources with TV value, where date is greater than current date[/li]
          [li]
          &tvFilters=`nameOfDateTV>>[[!getDate:date=`%Y-%m-%d %H`]]`
          : list only resources with TV value, where date and hour is greater than current date and hour [/li]
          [li]etc.[/li]
          [/ul]

          getDate is an extra and here you can find more useful examples: https://docs.modx.com/extras/revo/getdate