We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 42967
    • 143 Posts
    Hi,

    I am sorting by a date tv, it works fine, but past dates are shown at the top, I need to push them to bottom of the list somehow, is this possible?

    [[!getResources? &parents=`103`  &limit=`4` &tpl=`homeEventTpl` &sortbyTV=`eventStartDate` &sortdirTV=`ASC` &includeTVs=`1` &processTVs=`1` ]]


      Eighth day design
      Design agency with offices in Edinburgh and Brighton
      • 42602
      • 81 Posts
      Change the sortDirTV to DESC = descending (from biggest to smallest) where ASC is ascending from smallest to biggest
        • 42967
        • 143 Posts
        thanks Dunnock, but that will then show the older events first.. I need to show the latest events first, and put the past events last.
          Eighth day design
          Design agency with offices in Edinburgh and Brighton
          • 42602
          • 81 Posts
          Does not compute, it should show newest date first when ordering in descending order
            • 42967
            • 143 Posts
            ASC is correct because with a date nearest is first.
              Eighth day design
              Design agency with offices in Edinburgh and Brighton
              • 42602
              • 81 Posts
              MySQL date sorting, or general SQL sorting actually:

              Dates sorted in ASC
              2001-02-02
              2012-02-02
              2020-02-02

              Dates in DESC order
              2020-02-02
              2012-02-02
              2001-02-02
                • 3749
                • 24,544 Posts
                DESC is the default, so if you leave out the &sortDirTV property, you should get the newest ones first, unless the TV values are incorrect.
                  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
                  • 42967
                  • 143 Posts
                  Thanks Bob, but doing that (for me at least) shows the oldest (i.e furthest away) events first.

                  My TV has date set as input and output with the following format:

                  %Y-%m-%d


                  My code works fine and displays in the correct order, it just if the date has passed it is still shown before upcoming events, I need it to go to the back of the queue.
                    Eighth day design
                    Design agency with offices in Edinburgh and Brighton
                    • 42046
                    • 436 Posts
                    Could you give an example of the order in which you want dates sorted?

                    eg:
                    2013-08-12
                    2013-06-02
                    2013-04-14
                    2013-03-30
                    2013-03-29
                      • 42967
                      • 143 Posts
                      sorry, yes:

                      1 August, 2013
                      6 August, 2013
                      26 August, 2013

                      Then the events that have happened:
                      27 July, 2013
                      26 June, 2013


                      right now it looks like this:

                      27 July, 2013
                      26 June, 2013
                      1 August, 2013
                      6 August, 2013
                      26 August, 2013

                        Eighth day design
                        Design agency with offices in Edinburgh and Brighton