4 Replies Latest reply on Feb 7, 2017 8:58 AM by waynemartin

    Go to record by setting a field

    waynemartin

      I have a layout for my vehicles where i have my vehicle info. I have buttons on there to check out/check in vehicles, by checking out a vehicle it creates a new record in "service records" table. When i go to check in the vehicle and use "last" function it goes to the last record, but if i have multiple vehicles checked out it doesn't work.

       

      I have tried to capture the service record ID and inserting it in a set variable when i go to check vehicle back in but i can't get it to go to that particular record, maybe this could be done with "gotorecordrequestpage-by calculations" but i don't know how to get that to work.

       

      Any help would be greatly appreciated.

       

      Thanks

        • 1. Re: Go to record by setting a field
          jbrown

          Howdy.

          I'm not sure I can answer specifically because I don't know the how you've set everything up, but generally here's how it works:

           

          Your parent table, Vehicles, as a field that holds a unique ID of each vehicle.

          the Service record, a table holding records about each vehicle, the child table, should have a field that contains the ID of the vehicle for which the record is about.

           

          If that is the setup, then you need to use the concept of finding the service record of the vehicle that is checked out and check it in.

          Also I assume you ahve a field in the service record for "CheckedInDate" or "Flag_CheckedIn", something like that. Either of those are filled in during the check-in process.

           

          So here's what you need to do:

          1. Get the ID of the vehicle you're on currently. Set it in a variable.

          2. Go to the service record table. Find the record that has this vehicle's ID AND hasn't been checked out ( Set the CHeckedInDate field to "=" which means empty.

          3. Set that record's checkedINDate to whatever date you wish.

           

          You're following this concept.

           

          You could use the Go TO Related Record script step, which is powerful. To do this you'd have to set up a relationship between the vehicle table and the service record table to be related on the vehicle's ID. This will go to a new window (if chosen) of the service record's table and show you only all records that belong to this vehicle. That saves the steps of getting the vehicle ID and doing a find.

           

          This results in all the service records of this vehicle; you'd still have to find the one with the empty checkedInDate (most likely the last one) and check it in.

           

          I'll put together a quick demo and let you see this concept.

          • 2. Re: Go to record by setting a field
            jbrown

            Here's a demo file. i tried to explain the two methods. Hopefully you have FileMaker Pro Advanced. If so, use the script debugger to see what each does.

            • 3. Re: Go to record by setting a field
              philmodjunk

              If you can get the service record ID, you can set a Field set up to match to a different occurrence of your service records by service ID and then you can use set field and this new table occurrence to set fields in the service record.

              • 4. Re: Go to record by setting a field
                waynemartin

                Thank you very much Jeremy!

                 

                I have a checked out and a check in field on the vehicle home page, the first one gets populated by a script that runs when the check in button gets pressed, the second one gets populated when the script completes after the vehicle gets checked in.

                 

                So your solution worked great, I made the "second" relationship between the service::check out and the vehicle::check in, and now it works.

                 

                Thanks again.