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

    I’m having problems displaying the results in order.

    [[Ditto?sortBy=`pagetitle`&sortDir=`ASC`&debug=`1`]]

    The results are not being sorted.

    Here’s the debug result

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html> 
    		<head>
            <title>Debug</title> 
    		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    		<link rel="stylesheet" type="text/css" href="http://ctor-pas01/manager/media/style/MODxLight/style.css" /> 
    		<link rel="stylesheet" type="text/css" href="http://ctor-pas01/manager/media/style/MODxLight/coolButtons2.css" /> 
    	    <link rel="stylesheet" type="text/css" href="http://ctor-pas01/manager/media/style/MODxLight/tabs.css"/> 
    		<script type="text/javascript" src="http://ctor-pas01/manager/media/script/scriptaculous/prototype.js"></script> 
    		<script type="text/javascript" src="http://ctor-pas01/manager/media/script/scriptaculous/scriptaculous.js"></script> 
    		<script type="text/javascript" src="http://ctor-pas01/manager/media/script/tabpane.js"></script>
    		<link rel="stylesheet" type="text/css" href="http://ctor-pas01/assets/snippets/ditto//debug/main.template.css" />
            </head>
    
            <body>
    		<div class="sectionHeader"> Debug</div>
    				   <div class="sectionBody"> 
    			       <div class="tab-pane" id="docManagerPane"> 
    			       <script type="text/javascript"> 
    						tpResources = new WebFXTabPane( document.getElementById( "docManagerPane" ) ); 
    		</script>
    				<div class="tab-page" id="tab_Info">  
    				    <h2 class="tab">Info</h2>  
    				    <script type="text/javascript">tpResources.addTabPage( document.getElementById( "tab_Info" ) );</script> 
    					<table>
    				  <tbody>
    				    <tr>
    				      <th>Basic Info</th>
    				    </tr>
    				    <tr>
    				      <td>
    				      <table>
    				        <tbody>
    		
    					    <tr>
    					      <th>Version</th>
    					      <td>2.0.3</td>
    					    </tr>
    			
    					    <tr>
    					      <th>Summarize</th>
    					      <td>3</td>
    					    </tr>
    			
    					    <tr>
    					      <th>Total</th>
    					      <td>3</td>
    					    </tr>
    			
    					    <tr>
    					      <th>Sort By</th>
    					      <td>pagetitle</td>
    					    </tr>
    			
    					    <tr>
    					      <th>Sort Direction</th>
    					      <td>ASC</td>
    					    </tr>
    			
    					    <tr>
    					      <th>Start</th>
    					      <td>0</td>
    					    </tr>
    			
    					    <tr>
    					      <th>Stop</th>
    					      <td>3</td>
    					    </tr>
    			
    					    <tr>
    					      <th>IDs</th>
    					      <td>58, 59, 66</td>
    					    </tr>
    			
    				        </tbody>
    				      </table>
    				      </td>
    				    </tr>
    				  </tbody>
    				</table>
    				
    		</div>		<div class="tab-page" id="tab_Parameters">  
    				    <h2 class="tab">Parameters</h2>  
    				    <script type="text/javascript">tpResources.addTabPage( document.getElementById( "tab_Parameters" ) );</script> 
    					<table>
    				  <tbody>
    				    <tr>
    				      <th>Parameters</th>
    				    </tr>
    				    <tr>
    				      <td>
    				      <table>
    				        <tbody>
    		
    					    <tr>
    					      <th>debug</th>
    					      <td>1</td>
    					    </tr>
    			
    					    <tr>
    					      <th>sortBy</th>
    					      <td>pagetitle</td>
    					    </tr>
    			
    					    <tr>
    					      <th>sortDir</th>
    					      <td>ASC</td>
    					    </tr>
    			
    				        </tbody>
    				      </table>
    				      </td>
    				    </tr>
    				  </tbody>
    				</table>
    				
    		</div>		<div class="tab-page" id="tab_Fields">  
    				    <h2 class="tab">Fields</h2>  
    				    <script type="text/javascript">tpResources.addTabPage( document.getElementById( "tab_Fields" ) );</script> 
    					<div class='ditto_dbg_fields'><table>
    	<tr><th>display</th><th>backend</th></tr>
    	<tr><td>
    <table>
    	<tr><th>db</th><th>custom</th></tr>
    	<tr><td>
    <table>
    	<tr><td>id</td><td>pagetitle</td><td>introtext</td><td>createdby</td><td>published</td><td>createdon</td></tr>
    </table>
    </td><td>
    <table>
    	<tr><td>author</td><td>date</td></tr>
    </table>
    </td></tr>
    </table>
    </td><td>
    <table>
    	<tr><th>db</th></tr>
    	<tr><td>
    <table>
    	<tr><td>id</td><td>published</td><td>pagetitle</td></tr>
    </table>
    </td></tr>
    </table>
    </td></tr>
    </table></div>
    		</div>		<div class="tab-page" id="tab_Templates">  
    				    <h2 class="tab">Templates</h2>  
    				    <script type="text/javascript">tpResources.addTabPage( document.getElementById( "tab_Templates" ) );</script> 
    					<table>
    				  <tbody>
    				    <tr>
    				      <th>Templates</th>
    				    </tr>
    				    <tr>
    				      <td>
    				      <table>
    				        <tbody>
    		
    					    <tr>
    					      <th>tpl</th>
    					      <td><pre><div class="ditto_item" id="ditto_item_[+id+]">
            <h3 class="ditto_pageTitle"><a
    href="[~[+id+]~]">[+pagetitle+]</a></h3>
            <div class="ditto_documentInfo">by
    <strong>[+author+]</strong> on [+date+]</div>
            <div class="ditto_introText">[+introtext+]</div>
        </div></pre></td>
    					    </tr>
    			
    				        </tbody>
    				      </table>
    				      </td>
    				    </tr>
    				  </tbody>
    				</table>
    				
    		</div>		<div class="tab-page" id="tab_Retreived Data">  
    				    <h2 class="tab">Retreived Data</h2>  
    				    <script type="text/javascript">tpResources.addTabPage( document.getElementById( "tab_Retreived Data" ) );</script> 
    					<table>
    				  <tbody>
    				    <tr>
    				      <th>Illegal Character in the "Subject" Field of On-Do-Mail (58)</th>
    				    </tr>
    				    <tr>
    				      <td>
    				      <table>
    				        <tbody>
    		
    					    <tr>
    					      <th>createdby</th>
    					      <td>1</td>
    					    </tr>
    			
    					    <tr>
    					      <th>createdon</th>
    					      <td>1202587083</td>
    					    </tr>
    			
    					    <tr>
    					      <th>id</th>
    					      <td>58</td>
    					    </tr>
    			
    					    <tr>
    					      <th>introtext</th>
    					      <td></td>
    					    </tr>
    			
    					    <tr>
    					      <th>pagetitle</th>
    					      <td>Illegal Character in the "Subject" Field of On-Do-Mail</td>
    					    </tr>
    			
    					    <tr>
    					      <th>published</th>
    					      <td>1</td>
    					    </tr>
    			
    				        </tbody>
    				      </table>
    				      </td>
    				    </tr>
    				  </tbody>
    				</table>
    				<table>
    				  <tbody>
    				    <tr>
    				      <th>Return Code Mapping - Master list (59)</th>
    				    </tr>
    				    <tr>
    				      <td>
    				      <table>
    				        <tbody>
    		
    					    <tr>
    					      <th>createdby</th>
    					      <td>3</td>
    					    </tr>
    			
    					    <tr>
    					      <th>createdon</th>
    					      <td>1202745260</td>
    					    </tr>
    			
    					    <tr>
    					      <th>id</th>
    					      <td>59</td>
    					    </tr>
    			
    					    <tr>
    					      <th>introtext</th>
    					      <td></td>
    					    </tr>
    			
    					    <tr>
    					      <th>pagetitle</th>
    					      <td>Return Code Mapping - Master list</td>
    					    </tr>
    			
    					    <tr>
    					      <th>published</th>
    					      <td>1</td>
    					    </tr>
    			
    				        </tbody>
    				      </table>
    				      </td>
    				    </tr>
    				  </tbody>
    				</table>
    				<table>
    				  <tbody>
    				    <tr>
    				      <th>Control-M/EM Dynamic Filter - Odate format is YYMMDD (66)</th>
    				    </tr>
    				    <tr>
    				      <td>
    				      <table>
    				        <tbody>
    		
    					    <tr>
    					      <th>createdby</th>
    					      <td>3</td>
    					    </tr>
    			
    					    <tr>
    					      <th>createdon</th>
    					      <td>1202748213</td>
    					    </tr>
    			
    					    <tr>
    					      <th>id</th>
    					      <td>66</td>
    					    </tr>
    			
    					    <tr>
    					      <th>introtext</th>
    					      <td></td>
    					    </tr>
    			
    					    <tr>
    					      <th>pagetitle</th>
    					      <td>Control-M/EM Dynamic Filter - Odate format is YYMMDD</td>
    					    </tr>
    			
    					    <tr>
    					      <th>published</th>
    					      <td>1</td>
    					    </tr>
    			
    				        </tbody>
    				      </table>
    				      </td>
    				    </tr>
    				  </tbody>
    				</table>
    				
    		</div>
    		</body>
    </html>
    
    <!--- 02/11/08 17:22:14 --->
      • 7231
      • 4,205 Posts
      Try it like this just to eliminate any potential problems with the call:

      [[Ditto? &sortBy=`pagetitle` &sortDir=`ASC` &debug=`1`]]
        [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

        Something is happening here, but you don&#39;t know what it is.
        Do you, Mr. Jones? - [bob dylan]
        • 20845
        • 5 Posts
        Same result.
          • 27708 MODX Staff
          • 2,502 Posts
          What version of MySQL are you running? There is a apparently a sort bug that made its way into a recent release.
            Author of zero books. Formerly of many strange things. Pairs well with meats. Conversations are magical experiences. He's dangerous around code but a markup magician. Blog ✦ Twitter ✦ LinkedIn ✦ GitHub
            • 20845
            • 5 Posts
            2.11.3
              • 3749
              • 24,544 Posts
              I think the current MySQL version is 5.0.51 so maybe you’re looking at the wrong number?

              5.0.51 does have a significant bug related to sorted queries.

              Bob
                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
                • 7231
                • 4,205 Posts
                5.0.51 does have a significant bug related to sorted queries.
                I thought that the bug was related to sorting by ID. So that menuindex would not work but pagetitle would. I could very well be wrong rolleyes
                  [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

                  Something is happening here, but you don&#39;t know what it is.
                  Do you, Mr. Jones? - [bob dylan]
                  • 20845
                  • 5 Posts
                  My bad, it is 5.0.51.

                  I was looking at phpMyAdmin’s version :p
                    • 7231
                    • 4,205 Posts
                    My bad, it is 5.0.51.
                    So the bug must effect text sorts as well as ID sorting. It seems my understanding was wrong. shocked
                      [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

                      Something is happening here, but you don&#39;t know what it is.
                      Do you, Mr. Jones? - [bob dylan]
                      • 3749
                      • 24,544 Posts
                      My understanding is that It affects MySQL queries that include both SORT BY and GROUP BY. I don’t know for a fact that it affects Ditto, but it seemed likely that Ditto would have such a query under some circumstances.

                      I know if affects menu index sorting in Wayfinder because it bit me. >:(

                      Bob
                        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