3 Replies Latest reply on Sep 13, 2016 3:06 PM by philmodjunk

    Found set of last records

    stevaroni

      I need to be able to batch print the last performed equipment maintenance records for all equipment rented to a particular location. If I do a find for a location, I would find multiple records for each piece of equipment. I need to be able to exclude all except the last record made. The only way I can figure to do this is with a looping script the adds the last record primary key to a list. Once the list is complete it is used to create a multi-request find. I am sure that is not a very efficient way of doing this, so I am asking all of you very smart people out there if you have another approach.

        • 1. Re: Found set of last records
          philmodjunk

          A basic method for isolating the most recent record:

           

          Find the records, Sort them to make the most recent record first in your found set. Use Omit Multiple Records to omit all but that most recent record.

           

          But in your case, you want multiple "Most recent" records for a set of equipment. For that, I'd use a related table of equipment--one record per machine linked to your table of maintenance records. You can sort your relationship to make the most recent maintenance on any given machine the first related record or you can use a one row portal to show this information and specify a sort on the portal.

           

          Either way, you get a list of Equipment where you can perform your find to get a list of equipment records and see the most recent maintenance on each.

          • 2. Re: Found set of last records
            stevaroni

            I have used your method in other situations where I need the most recent record to be found. But in this case I need a whole list of the the most recent maintenance record on each piece of equipment at a particular facility. In other words, if I were to look up all of the rental equipment at a location, I might find I have 50 different pieces of equipment on rental. For each of those 50 items, I need to be able to identify the last maintenance record created. I then need to be able to print out or email those records to a customer. (Perhaps you are understanding what I am needing and I am not understanding your first response.)

            • 3. Re: Found set of last records
              philmodjunk

              I suggest that you read my complete response. I mentioned a basic method and then described a way to get what you want by finding the equipment needed and then using either a sorted relationship or sorted portal to list the most recent maintenance record for each item of equipment.