4 Replies Latest reply on Sep 12, 2011 9:53 AM by willrollo

    Rolodex sort question

      Title

      Rolodex sort question

      Post

      Hi all

      I have managed to adapt the rolodex formula to my'enquiries' table. It does a very useful sort of all my surnames on the test database records..

      However, I want to add the 'company' field to the sort. At the moment, the calculation looks at the surname of the contact at the company. I want to be able to say If the company field is not empty, then sort by surname and company fields mixed together and if the company field is empty then just sort by surname

      Any suggestions....?

      Thank you
      Will

       

      screen-capture-1.png

        • 1. Re: Rolodex sort question
          mgores

          You can just add the sort record step into your script and define the fields you want it to sort by there.

          • 2. Re: Rolodex sort question
            LaRetta_1

            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 )

            • 3. Re: Rolodex sort question
              mgores

              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).

              • 4. Re: Rolodex sort question

                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...