1. Marie Bisschoff
  2. PowerBuilder
  3. Friday, 12 June 2020 13:51 PM UTC

HI,

Why does the row move if I have sort on the header and the values is the same and I keep hitting the sort.

 

 

Regards

MLB

mike S Accepted Answer Pending Moderation
  1. Friday, 12 June 2020 14:11 PM UTC
  2. PowerBuilder
  3. # 1

what is your sort

Comment
  1. Marie Bisschoff
  2. Friday, 12 June 2020 14:14 PM UTC
HI,



IF dwo.Name = "t_vendor_no" THEN



This.SetSort("ord_vendor_order_vendor_code ASC")

This.Sort()



END IF
  1. Helpful
  1. Marie Bisschoff
  2. Friday, 12 June 2020 14:15 PM UTC
This is on the click event
  1. Helpful
There are no comments made yet.
John Fauss Accepted Answer Pending Moderation
  1. Friday, 12 June 2020 14:22 PM UTC
  2. PowerBuilder
  3. # 2

Your question is a little cryptic, Marie...

I assume your app has code that sorts the contents of a DataWindow when the user clicks on a column heading text label, and that, in your example, you click on either the Vendor No. or Description column heading and result after sorting shows the rows in a different order (as evidenced by the order number). Correct?

When you sort on the values contained in a single column and there are multiple rows containing the same value in that column, then this can happen because there are no additional conditions that will enforce the relative order of the rows to be "preserved". The DataWindow is doing exactly what you requested it do and nothing more. You're assuming it's going to do something you haven't told it to do.

If you want the sort to take into account additional columns you'll have to either use the PB Sort dialog window or enhance the column-heading-click/sort user interface to take multiple columns into consideration.

Regards, John

Comment
There are no comments made yet.
Marie Bisschoff Accepted Answer Pending Moderation
  1. Friday, 12 June 2020 14:50 PM UTC
  2. PowerBuilder
  3. # 3

HI,

Here I only sort on Vendor No.

I just keep hitting it and the row moves.

Regards

MLB

Comment
  1. mike S
  2. Friday, 12 June 2020 15:13 PM UTC
the sort is working correctly



you need to write logic to reset it the way you want after the sort





  1. Helpful
There are no comments made yet.
Olan Knight Accepted Answer Pending Moderation
  1. Saturday, 13 June 2020 05:08 AM UTC
  2. PowerBuilder
  3. # 4

Marie -

   To expand on John's answer: when we do a column sort we expect JUST the one column to be considered in the sorting process - that is what we intuitively think should happen.

   However, the if a DW has more than one column, the other columns will still magically get involved, even though they really should not have any effect on the SORT command you issued. I have seen the same thing happen to me, and it has been this way forever.

   The good news is that usually you can either ignore it, or as a quick work-around sort on another column header, then the original one to get back to the sequence you expect.

   Another work-around:

ll_rc = this.setredraw (false)

ll_rc = this.SetSort ("")
ll_rc = this.Sort()

ll_rc = this.SetSort ("ord_vendor_order_vendor_code ASC")
ll_rc = this.Sort()

ll_rc = this.setredraw (true)


Later -

Olan

Comment
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.