Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Datawindow filter changing order of rows

Status
Not open for further replies.

sriblon

IS-IT--Management
Jul 9, 2009
10
0
0
US
I have a menu item that when clicked, it will filter the datawindow (using a hard-coded value at this point). If the menu item is clicked again, the filter will be cleared.

The problem is, when the menu item is clicked again (to once again filter the data), the rows are now in a different order (can't seem to find any logical mapping - sorting is still by the correct column (not unique), but within each sorted set, the order of the rows is different). I don't know if this matters, but I am filtering by the same column as the sort column.

I don't want the order of the rows to change if this filter is clicked again.
Please help! Here is my code: (Note:str_userName is passed into the Function, an empty string would represent a wish to "clear" the filter)

string str_criteria

if str_userName <> "" then
str_criteria = "rep = '" + str_userName + "'"
else
str_criteria = ""
end if

dw_file_viewer.setfilter (str_criteria)
dw_file_viewer.filter( )

return
 
It works in that way as long as I remember. Try to use sort after filtering your data.

Tomek
 
I've never heard a logical explanation of this phenomenon, nor have I ever looked into it. I just accepted that it happened, used the SetSort( ) & Sort( ) and moved on... Though I am curious now as to the "why" this occurs.
 
I am curious why this happens as well. I have implemented my sorts and thus am also "moving on," but would love to see this handled better in future PB versions.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top