About   -   Contact   -   Purchase   -   Search   -   What's New

Dropdown Datawindow Sort
The datawindow is the most powerful and flexible tool in a PowerBuilder developers arsenal. One nice feature most developers include is a quick sort service to allow the users to click on column headings to sort the data.

The sort function allows you to specify the column name or number to be sorted by. This works great for most columns and data types, but it does not work well when a column is a dropdown datawindow. The problem is that the sort function sorts the data value behind the dropdown datawindow not the display value the user sees.

To overcome this problem you can make use of the LookUpDisplay command. This function returns the display version of the data in a column. By wrapping the column name inside this function and using it to sort the data, your user will see the data sorted by the display value and be none the wiser. For example:

dw_1.SetSort( 'LookUpDisplay( dept_id )' )

Top of Page

Legal Notice

Ken Howe 2011