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

    Forgive me if this has been answered before, have searched and not come up with anything.

    I have a list of items called via Ditto.
    They are being sorted by their longtitle, which is the year they were made.
    This is a great way of sorting, but quite a few items were made on the same year.

    What is the default sorting behavior when the Ditto encounters identical years like this.
    I would have guessed that to sort through the identical ones, it would revert to menuindex, but that doesn’t seem to be the case.

    Is there a way of specifying what secondary method to fall back onto?

    Thanks a lot in advance,

    David
      • 20413
      • 2,877 Posts
      Use
      &orderBy=`menuindex DESC`

      or whatever Document Object

      DESC = Descending A-Z
      ASC = Ascending Z-A


        @hawproductions | http://mrhaw.com/

        Infograph: MODX Advanced Install in 7 steps:
        http://forums.modx.com/thread/96954/infograph-modx-advanced-install-in-7-steps

        Recap: Portland, OR (PDX) MODX CMS Meetup, Oct 6, 2015. US Bancorp Tower
        http://mrhaw.com/modx_portland_oregon_pdx_modx_cms_meetup_oct_2015_us_bancorp_tower
        • 16845
        • 26 Posts
        Thanks, but I’m after what happens if the Document Object or TV it’s sorting by are identical. What’s the fallback?

        Say I’m ordering by longtitle. Using &orderBy=`longtitle DESC` will get me half the way, but 2 of the items have the same longtitle --> 2009.
        How is Ditto going to order the two items from 2009 that have the same longtitle?

        Is it going to order them by menuindex, alphabetically, etc? There must be something in place, a fallback?

        Thanks in advance,

        David
          • 16845
          • 26 Posts
          Yeah, the funny thing is it seems to alternate sometime. One time Item 1 will be first, another time Item 2...
          I suppose it’s best to have more precise sorting in place to avoid the issue...

          Thanks for you answers.
            • 16278
            • 928 Posts
            Use the Ditto 2.1 sorting parameter &orderBy, which can take multiple sort order: &orderBy=`field1 direction,field2 direction`.
            wink KP
            Sorting example on Pogwatch
              • 36416
              • 589 Posts
              Quote from: lechatlisse at Sep 18, 2009, 01:47 AM

              Yeah, the funny thing is it seems to alternate sometime. One time Item 1 will be first, another time Item 2... I suppose it’s best to have more precise sorting in place to avoid the issue...[/q]

              Yes, its a SQL server feature not to care about order if when fetching dataset.

              Thanks for you answers.

              orderBy parameter allows for full SQL ordering syntax, for example:
              Ditto? ... &orderBy=`pagetitle ASC, menuindex DESC` ...
              
                • 16845
                • 26 Posts
                AMAZING (and yes that’s in capital letters).

                Thanks a million!