2 Replies Latest reply on Oct 28, 2016 7:58 AM by Stu412

    Find top 57 records

    Stu412

      Hi there

       

      I have a scenario where I need to get the top 25% of records from a varying size of found set and I'm looking to script this.  The top 25 records need to be the highest in value from the overall found set, so currently I have something like this (Forgive the pigeon scripting):

       

      Enter Find Mode

      Set Field (Code = 10)

      Perform Find

      Sort by Value, Descending

       

      This returns say, 225 results.  I can use Get(FoundCount)/4 to establish I actually need 56.25 (57) records.

       

      So, how can I remove the bottom 168 records from the found set?

       

      This will form part of a script which will loop over around 100 times (the code 10 above is just one of many codes), so ideally needs to act nicely in a loop.

       

      Thanks in advance

        • 1. Re: Find top 57 records
          beverly

          there is an OMIT MULTIPLE RECORDS (menu and Script Step).

           

          once you calculate the place to omit, go to record (by number + 1) and then omit multiple (based on the total number of records or "found count"), this may show the dialog (if you allow) that says, you only have 'x' records (to the end of the found count) to omit and continue. Only those number of records will be removed from the found set of records. NOTE: I said removed, not deleted.

           

          Omit multiple is handy and based on the current record you are on. Try it manually so you understand, then use the script step.

           

          beverly

          • 2. Re: Find top 57 records
            Stu412

            Genius!

             

            Thanks Beverly, I can put together a 7 line addition to my loop script and this will work through the various codes.  It's quick as well compared to the other options.

             

            Thanks very much