Hi Terry,
You can only sort by fields which are in the View. (So local calculated fields are out.)
In the second example, as far as I can see, you are still loading the secondary record manually in the BrowseRow routine; Your code is;
CTY:CountryID = MAI:CountryID
GET(Country,CTY:PK_CountryID)
IF ERRORCODE()
message(clip(error()))
COUNTRY:CountryName = 'TBA'
ELSE
END
This code should be completely removed. Loading records like this is very inefficient, and very SQL unfriendly.
Rather add the Country table to the Mailboxes table (ie as a child table) in the Data pad, and remove it from OtherFiles.
then the country name becomes part of the view, and you can sort on it.
This might be a good tip for the Webinar on Thursday if I can remember it
cheers
Bruce