Note that there are some explanatory texts on larger screens.

plurals
  1. POWhat logic is used to order the sorted rows of a PowerBuilder DataWindow that contains duplicates in the sorted column?
    text
    copied!<p>As is known, the data windows in PowerBuilder can be fashioned to sort the rows based on a columns value. This works fine if the values in that column are unique. However; I am working on a situation where those columns are not always unique and as a result, when the Sort() function is applied to the DataWindow, the duplicates are ordered in respect to the other rows but are not ordered in anyway themselves.</p> <p>A better way to say this would be through a diagram.</p> <p>Imagine the following data window:</p> <p>Sort applied once<br/> ID DESCR ACTIVE <br/> 1 ABC 1 <br/> 2 BCD 0 <br/> 3 BCD 1 <br/> 4 CDE 1 <br/></p> <p>Sort applied twice<br/> ID DESCR ACTIVE <br/> 1 ABC 1 <br/> 3 BCD 1 <br/> 2 BCD 0 <br/> 4 CDE 1 <br/></p> <p>Sort applied thrice<br/> ID DESCR ACTIVE <br/> 1 ABC 1 <br/> 2 BCD 0 <br/> 3 BCD 1 <br/> 4 CDE 1 <br/></p> <p>If I apply a ascending sort to the DESCR column, the two BCD rows will switch places. I am only applying the the sort on the DESCR column remember. It seems like the sort functionality randomly assigns a position to values that are duplicated. In my example, if I continually apply the sort function to that data window with an ascending sort on DESCR, the BCD rows will switch back and forth places.</p> <p>For the question I have, does anyone know why it works this way? I have an idea of how to maybe solve it by applying a secondary sort to a hidden column that numbers sets of duplicate values. In my case, ID 1 would be assigned a 1. ID 2 would get a 1 and ID 3 would get a two. This way, the BCD values could be sorted on the DESCR, and then on this hidden column.</p> <p>However; that is a lot more hassle to just keep the rows in the same order. Just polling the PowerBuilder developer community here on Stack to see if they've encountered this and if they've fixed it or know for sure that PB just randomly assigns an order to duplicate values in a sorted row.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload