5 Replies Latest reply on Jul 12, 2012 7:02 AM by JustinTylerMoore

    Simple History Field and Appending Data

    JustinTylerMoore

      Title

      Simple History Field and Appending Data

      Post

      Hello All,

      I am new to FileMaker, but i know my way around software pretty well.... Here's what I am trying to accomplish:

      i have an inventory system that I have set up. I have a "checked-out to" field with the emplyees name, and a "checked-out date" field with the, you guessed it, checked out date. I also have a text field called "history" in the table. What I would like to do is create a "Check In" button that executes a script that does a few things. 

      1) Copies the "Checked-Out To" and "Checked-Out Date" data,

      2) Appends it in the "History" field, and adds a current timestamp and line break, then

      3) Changes the "Checked-Out To" and "Checked-Out Date" back to default.

       

      This in my head seems fairly straightforward, but I'm not sure i'm understanding it correctly.

      Any help is greatly appreciated!!! Thanks

      -justin

      Screen_Shot_2012-07-10_at_11.04.30_AM.png

        • 1. Re: Simple History Field and Appending Data
          philmodjunk

          It can be done, but I suggest a related history TABLE where you can create a new related record to log this data will be simpler and easier to use. You can use a portal to display the data in the portal. This allows you to enter date and/or timestamp data in fields with those specific data types--which can make for much easier date/time based searching and sorting of your data, plus better display of the same.

          Just to answer the specific question even thought I recommended against it:

          Set Field [ YourTable::History ; List ( YourTable::CheckedOutTO & " - " & YourTable::CheckedOutDate ; YourTable::History ) ]
          Set Field [ YourTable::CheckedOutTO ; "" ]
          Set Field [ YourTable::CheckedOutDate  ; "" ]

          I'm assuming that you want to assign "default" values that clear the fields.

          • 2. Re: Simple History Field and Appending Data
            JustinTylerMoore

            Thanks Phil! This worked just like I had hoped! Earlier, one of the other employees here was suggesting exactly what you were as well, but maybe you can elaborate more on why we wouldn't want this history info stored with each assets table, as opposed to your suggestion in a new table.... 

             

            -Justin

            • 3. Re: Simple History Field and Appending Data
              philmodjunk

              IF you try it and see for yourself, I think you'll find that it's much more flexible. It also opens the door to reporting options of an employee's history records that wont' be possible with all the data "smooshed" into one field.

              The script you might use for that:

              Set Variable [$ItemID ; Value: YourTable::__pkItemID ]
              Set Variable [$Date ; Value: YourTable::CheckedOutDate ]
              Set Variable [$To ; Value: YourTable::CheckedOutTo ]
              Freeze Window
              Go To Layout [History]
              New Record/Request
              Set Field [History::_fkItemID ; $ItemID ]
              Set Field [History::Date ; $Date ]
              Set Field [History::To ; $To ]
              Go to Layout [original layout]
              Set Field [ YourTable::CheckedOutTO ; "" ]
              Set Field [ YourTable::CheckedOutDate  ; "" ]

              If you place a portal to history on your layout, you'll see a new entry automatically appear each time this script is run.

              • 4. Re: Simple History Field and Appending Data
                JustinTylerMoore

                Phil,

                Sorry I've been at lunch. I'm trying this method now. I'll post my results!

                • 5. Re: Simple History Field and Appending Data
                  JustinTylerMoore

                  Phil,

                   

                  THIS WORKED GREAT!!!! Thank you for your quick and extremely helpful response! I'm just now understanding the power of FileMaker and can not wait to expand upon my knowledge! Thanks for lighting that fire under me. lol.

                   

                  -Justin