You will need to track the sort criteria. a pointer to the field (if only one), or a text of the sort (for Execute Formula).
In your example: my_listbox_Sort_Field:=->[members]FirstName IF - you want the lsitbox always sorted on one field then the above works with code like this: $Table_ptr:=table(table(my_listbox_Sort_Field)) Order by ($table_ptr->; my_listbox_Sort_Field->;>) Alternatively, if you want the listbox sorted on the selected column, use the header click, or on after sort form event to determine the source field of the column, assign that to 'my_listbox_Sort_Field' and then use the above 2 line sort. Of course you may need to be a bit more proactive in determining your table to sort on, as a related field would give the wrong (or no ) sort using the 2 lines above. My listbox manager is too much code to place here. but the outline is: determine the listbox to be populated determine what data to put into the columns get the default sort field, and sort the data User clicks on header, the data will sort itself, and the action of clicking on the header sets a pointer which points to the field the column is showing. If the selection changes, then code uses the pointer (as above) to sort the new selection On Wed, 24 Aug 2016 20:53:55 +0000, Sannyasin Siddhanathaswami wrote: > Aloha, > > Thanks Arnaud for the code to get the sort of a header clicked. > Definitely helpful. > > Kirk: I like the idea of using named selection listboxes, but it my > testing it’s pretty cumbersome to do simple things. For example, you > can’t Order By a named selection. You have to copy it to the current > selection, order it, then copy it back. Also, you can’t do a “Query > Selection in Named Selection.” > > I don’t see how to keep the sort order of a selection (or named > selection) when doing a query of that selection. > > For example: > All records ([members]) > Order by ([members];[members]FirstName;>) > query selection ([members];[members]FirstName=“John”) > > Any clue how to keep the FirstName Asc sort? > > > > -- > Sannyasin Siddhanathaswami > > ********************************************************************** > 4D Internet Users Group (4D iNUG) > FAQ: http://lists.4d.com/faqnug.html > Archive: http://lists.4d.com/archives.html > Options: http://lists.4d.com/mailman/options/4d_tech > Unsub: mailto:[email protected] > ********************************************************************** ********************************************************************** 4D Internet Users Group (4D iNUG) FAQ: http://lists.4d.com/faqnug.html Archive: http://lists.4d.com/archives.html Options: http://lists.4d.com/mailman/options/4d_tech Unsub: mailto:[email protected] **********************************************************************

