How to dynamically sort a Browser

Matias Borra

New Member
Hi there ! I'm trying to develop a standard window to use it as a template. So I want to sort its browser by a column after clicking in the column name but without specifying the name of the column in the open-query.

For example with:
ON start-search DO:
open query ... by 1 /* where 1 is the column number.*/
END.

This is my idea but I can't carry it out. Anybody knows how to do it? Anybody can give me some tips to take into account?

Thanks in advance.

Matías.
 

schaapie

Member
Eh? Open query isn't dynamic.
Isn't "self" in this trigger the column?
So you can do:
query-prepare("... by " + self:name).
or something like that.
 

RKR

Member
SELF is the handle of browse widget. in the start search self:current-column:name returns the field name of the column you clicked. :D

When you have a dynamic query you can add this column in the by-phrase of the query-prepare-string and re-open the query.

when you work with static query's it becomes a little more complex because you have to code all the possible query's and the sort-order and open the correct query based on the column name. If you understand how to use XFTR's in the appbuilder then it is possible to generate all possible query's at design time. :(
 
Top