3 Replies Latest reply on May 15, 2017 9:10 AM by LarryMarkus

    Last Record

    LarryMarkus

      To explain my dilemma, I have a table called Fuel Usage....there are an number of fields, this issue deals with 3 fields..

      1) Unit Number

      2) Todays End Mileage

      3) Last Ending Mileage

       

      I want the Todays Mileage value in the record to replace the Last Ending Mileage next time a record is created for that Unit Number to record Todays Mileage.

        • 1. Re: Last Record
          TSPigeon

          LarryMarkus:

           

          Thank you for your post!

           

          You'd most likely want to script this in some way. It might look something like:

          If [ IsEmpty(TodaysMileage)]

               GotoRecord/Request [Previous]

               Set Variable [ $mileage ; LastEndingMileage]

               GotoRecord/Request [Last]

               Set Field [TodaysMileage ; $mileage]

          EndIf

           

          Perhaps triggered on Layout enter. This is just an idea -I'm sure developers will have stronger advice.

           

          I'm also going to move this thread from the FileMaker Community Feedback Space (which is specifically for input on the Community itself) to the Discussions Space where you should receive more views and potentially that feedback from developers on this!

           

          TSPigeon

          FileMaker, Inc.

          • 2. Re: Last Record
            philmodjunk

            If I understand correctly, these are the key points:

             

            a) you have more than one vehicle, (a "unit" in your terms) for which you are recording this info and each vehicle is identified by a unit number.

            b) You want "todays end mileage" in the previous record for this vehicle to be entered as "Last Ending mileage" of the new record for that vehicle that you are now adding to the table.

             

            Set up  a self join relationship between this layout's table and another occurrence of the same table. Use the unit number field as the match field on both sides of the relationship. This matches any given record on your layout to all records in the same table for the same vehicle. Double click the relationship line to open a dialog where you can specify a sorted relationship and click the sort option for the new table occurrence that you've just added. You'll need to sort your records in descending order on a field that either: Auto-enters the creation date, Auto-enters the creation time stamp or that auto-enters a serial number. Sorting any such field makes the most recent previous record for this vehicle the first related record. You can then set up an auto-enter calculation on the Last Ending Mileage field to auto-enter the value of Todays End Mileage from this related record.

            • 3. Re: Last Record
              LarryMarkus

              Thank you ........ issue resolved

               

              Larry Markus