6 Replies Latest reply on Jun 14, 2013 9:52 AM by paul350passaic

    Button for automatic Time Stamp using repeating fields

    paul350passaic

      Title

      Button for automatic Time Stamp using repeating fields

      Post

           Hi all,

           Im new in filemaker (and have no background in scripting or programming). Im using filemakerpro for small buisness. So pardon my non-technical terms :)

           Im trying to set/add a button in the free TimeCard template from filemaker so it will automaticaly fill the StartTime and EndTime with the current time(so no more manual inputing of time). I saw this article advising to use this script:

            

      SetField[Yourtable::timestampfield, get(currentTimeStamp)]

            

           It worked well but for the first field only. The StartTime and EndTime field is a "repeating field" so the button only fills the ist field. 

           Any help would be appreciated :) Thanks in advance!

            

            

        • 1. Re: Button for automatic Time Stamp using repeating fields
          philmodjunk

               When you double click the script step to get the dialog for selecting the field for the first parameter, you'll see that there's a field in the dialog for specifiying the repetition.

          SetField[Yourtable::timestampfield[2], get(currentTimeStamp)]

               Will set the second repetition of the timeStampField.

          SetField[Yourtable::timestampfield[$k], get(currentTimeStamp)]

               will set the repetition determined by the value of $K.

                

          • 2. Re: Button for automatic Time Stamp using repeating fields
            paul350passaic

                 Thanks for the quick reponse PhilModJunk! That was easy... It was right infront of me :) 

            • 3. Re: Button for automatic Time Stamp using repeating fields
              philmodjunk

                   Easy, but the starter solution you have selected make sthe unfortunate choice to use repeating fields. They are rarely the best design choice for a database and I had I developed this starter solution, I would not have used them.

              • 4. Re: Button for automatic Time Stamp using repeating fields
                paul350passaic

                     I agree with you with the repeating fields. I find it limited in a way. But then... I dont have the knowlede to create database from scratch :) I'll prolly try the FM training series sometimes.

                • 5. Re: Button for automatic Time Stamp using repeating fields
                  philmodjunk

                       Repeating fields can be replaced with portals to related tables where each repetition becomes a different record in the related table. This is more complex to set up--which is probably why the starter solution uses repeating fields, but much more flexible when it comes to working with the data entered into these repetitions. If I were new to FileMaker, I wouldn't just jump in and try to make that change, but I would keep it in mind as I gain more and more knowledge about how FileMaker works.

                       As an example, with the daily hours worked by each employee each entered into a different record for each day, it's fairly simple to set up a report that lists the total hours worked by all employees, broken down by individual days. Trying to produce the same report from a repeating field where each repetition records the hours worked for one day and the record then represents total work for a week, is not nearly so simple to set up.

                       And there's an option in Import Records that actually makes it very easy to move data from a set of repeating fields into a new table with the repetitions split up into individual records. The "heavy lifting" that you still have to do is in redesigning layouts and relationships to work with the related table in place of the repeating field(s).

                  • 6. Re: Button for automatic Time Stamp using repeating fields
                    paul350passaic

                         True enough. I passed on to creating summary report for each day since its a repeating field which has no separate identity. So instead I used weekly report where the total for each week came in handy. Thanks again!