You can just add the sort record step into your script and define the fields you want it to sort by there.
But only one sort can be applied to a set of records. If some records should be sorted by one field and other records should be sorted by a different field, you will need to create a calculation which CHOOSES which data should be sorted per record (and displays that desired sort value) so the sort can be applied equally to the found set by sorting that calculation. All we have to do is figure out what this means ....
"then sort by surname and company fields mixed together "
How do you want the two fields 'mixed'? Do you want Surname & " " & Company? Or do you want Company & " " & Surname? Anyway, whatever this 'mix' should look like, write that into the calculation, similar to:
Case ( IsEmpty ( CompanyField ) ; Surname ; Surname & " " & CompanyField )
If it were me, I would want to see the company name first, if it exists so it would be:
Case ( IsEmpty ( CompanyField ) ; Surname ; CompanyField & " - " & Surname )
If you did a find for surname, would you need to do a sort by surname? If you define your sort to go first by company then by surname, the first records in the sort will be those with no company names entered, then in groups of contacts with the same company sorted by surname. If you sort by surname first then company, they will be in order of surname and people with the same surname will be in the order of company name (those with no company being first).
Perfect - thank you everyone. LaRetta, I used your solution as it was more relevent to my needs. Mark G - thank you also for your help and advice...