We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 15152
    • 360 Posts
    I’m trying to get ditto to output by the closest upcoming date in a TV but can’t get it to work properly. Can anyone look at this and let me know what’s wrong. Using EVO. "startDate" is my TV.

    [[Ditto? &startID=`18` &summarize=`10` &removeChunk=`Comments` &tpl=`eventInfo` &paginate=`1` &orderBy=`startDate ASC` &dateSource=`startDate` &sortOrder=`DESC` &extenders=`summary,dateFilter` &paginateAlwaysShowLinks=`1` &tagData=`documentTags`]]

    Thanks
      There are no boring projects. Only boring executions. ~ Etzkorn
      www.impress-design.com
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      Get rid of the "&sortOrder" parameter; that is handled with the &orderBy parameter.
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 15152
        • 360 Posts
        Did that, Susan, still doesn’t change anything. (Cleared cache etc).

        [[Ditto? &startID=`18` &summarize=`10` &removeChunk=`Comments` &tpl=`eventInfo` &paginate=`1` &dateSource=`startDate` &orderBy=`startDate ASC` &extenders=`summary,dateFilter` &paginateAlwaysShowLinks=`1` &tagData=`documentTags`]]
          There are no boring projects. Only boring executions. ~ Etzkorn
          www.impress-design.com
          • 36592
          • 970 Posts
          Try uncached form like... [!Ditto? ... !]
            • 15152
            • 360 Posts
            Tried that. Doesn’t change anything. I’m stumped and not happy. The site is live now. This seemed easier in 9.6whatever. Is there anything that needs to be installed or changed at all for this to work?
              There are no boring projects. Only boring executions. ~ Etzkorn
              www.impress-design.com
              • 36592
              • 970 Posts
              How have you configured your startDate TV ?
              Does that output UNIX time value ?

              And what is not working properly ?
              Does it sorted by other parameter (like creatdon or something) ?
                • 15152
                • 360 Posts
                Fixed it. I changed the code to:

                [!Ditto? &startID=`18` &summarize=`3` &removeChunk=`Comments` &tpl=`eventsFP` &paginate=`1` &dateSource=`beginDate` &sortBy=`beginDate ASC` &extenders=`summary,dateFilter` &paginateAlwaysShowLinks=`1` &tagData=`documentTags`!]

                Used sortBy instead of orderBy

                Thanks for the help.
                  There are no boring projects. Only boring executions. ~ Etzkorn
                  www.impress-design.com
                  • 16278
                  • 928 Posts
                  May not be as fixed as you think - the Ditto snippet converts &sortBy (which has no ordering ASC or DESC specifier - that’s set by &sortDir in the obsolete parameters) into createdon if it has no valid data (see snippet from snippet below).

                  You now have
                  &sortBy=`beginDate ASC`
                  compared to
                  &orderBy=`startDate ASC`
                  in the earlier post - have you tried &orderBy=`beginDate ASC`?
                  wink KP

                  // Ditto snippet lines 236 et seq.
                  //---Parameters------------------------------------------------------- /*
                  if (isset($startID)) {$parents = $startID;}
                  if (isset($summarize)) {$display = $summarize;}
                  if (isset($limit)) {$queryLimit = $limit;}
                  if (isset($sortBy) || isset($sortDir) || is_null($orderBy['unparsed'])) {
                      $sortDir = isset($sortDir) ? strtoupper($sortDir) : 'DESC';
                      $sortBy = isset($sortBy) ? $sortBy : "createdon";
                      $orderBy['parsed'][]=array($sortBy,$sortDir);
                  }
                      // Allow backwards compatibility
                  
                    • 15152
                    • 360 Posts
                    KP52
                    How should the snippet call look, then. I’d like to get it right as it’s something I use often.
                      There are no boring projects. Only boring executions. ~ Etzkorn
                      www.impress-design.com
                      • 16278
                      • 928 Posts
                      Substituting the current parameter names and the changed date TV name into your original call gives:
                      [[Ditto? &parents=`18` &display=`10` &removeChunk=`Comments` &tpl=`eventInfo` &paginate=`1` &dateSource=`beginDate` &orderBy=`beginDate ASC` &extenders=`summary,dateFilter` &paginateAlwaysShowLinks=`1` &tagData=`documentTags`]]


                      If that doesn’t work, and if [+date+] shows up the date correctly with &dateSource set to the same TV you want to order results by, first thing to check is your version of MySQL.
                      smiley KP