8 Replies Latest reply on Aug 9, 2014 8:26 AM by pademo57

    Creating a Simulated Clock

    pademo57

      Title

      Creating a Simulated Clock

      Post

           Hi There,

           We have developed a simulation which runs for one hour using a 24 hour clock.  When the simulation starts it shows a time of 14:00. We are using Filemaker Pro Advanced 13 on a laptop. So when the simulator starts we would like to have a button in Filemaker on the laptop that an instructor could press which would start a timer showing the minutes ticking by.

           The instructor would then add a record in a portal which would show the current simulated time (e.g. 14:09) in one field and in the next field (called Comments) the instructor could write his or her comments on how the student is doing during the simulation.

           I hope I have explained this well enough for someone to understand. I've included a screenshot and hopefully that will make it clearer.

           Is this possible?

           Or is there a better way to note the time passed and add comments in a record which is in a portal?

      Factory1.JPG

        • 1. Re: Creating a Simulated Clock
          philmodjunk

               You'll have trouble getting that time to update like a digital clock display but if you click a button at the start of the simulation to log the actual time, another button can add a new comment record and use the elapsed time to compute the simulation time and log it in a field in the same record.

               You'll find it much more flexible to have multiple records with one record for each comment rather than multiple comments logged with different times all in one field. (This is a possibility suggested to me by what I see in your screen shot.) You may want to use a portal to a related comments table for logging them.

          • 2. Re: Creating a Simulated Clock
            pademo57

                 Thanks PhilModJunk,

                 So would I create a button that is a time field, (in this case showing 14:00) and make it clickable? 

                 Then when I create a new portal record it would put the time in the "Time" field by getting the time from the button above?

                 Am I headed in the right direction?

            • 3. Re: Creating a Simulated Clock
              MichaelVoccola

                   If you go the route of logging your comments in a different, related table, then add an auto-entry calculation resulting in time into a field called "Elapsed" on the comments table ( Comments::Elapsed ) where the auto-entered calculation = Get(CurrentTimeStamp) - $$StartTimeStamp.

                   When the simulation starts, program the "START" button to set the global variable $$StartTimeStamp as Get(CurrentTimeStamp).

                   Creating a new comment will automatically enter the a value in Comments::Elapsed equal to the total elapsed time in seconds.

                   This eliminates the need for a continuously running script. If you want the clock on the report to count-down, you will need to opt for a looping script to run the clock, but can still use the above-mentioned approach for actually calculating elapsed time on a new comment record.

              • 4. Re: Creating a Simulated Clock
                Markus Schneider

                     Not sure if I got it right - but there are examples around using a webviewer with php code. Using a bit of 'svg'- commands, even an analog-clock is possible. Drawback is that this eats resources... cpu, battery.. 

                     I would vote for Michael Voccola's solution..

                     If You are interested in the php-webviewer-method: Just google for 'filemaker clock php'. It should be possible to show a running clock - and when the user takes any action that has to stop the clock, the time can be catched using 'get(SystemTime', etc.

                • 5. Re: Creating a Simulated Clock
                  pademo57

                       Hi There,

                       Still having a bit of problem setting this up.  I created a Start button which puts in a timestamp the field beside the Start Time Stamp. But instead of getting the current time it shows: 

                       01/01/0001 12:00 AM

                       In the button setup I used the calculation: $$StartTimeStamp = Get(CurrentTimeStamp)

                       What I am trying to do is to use the Exercise Start time (in this case 17:00) and then when I put in a comment in the portal,  it will use the Exercise Start time and calculate the difference between when I clicked Start and the 17:00. For example 17:09.

                       I would like it to show only the minutes between when I clicked Start and when I am trying to put in a comment.

                       Where have I gone wrong?

                        

                  • 6. Re: Creating a Simulated Clock
                    raybaudi

                         The start button has to write the current timeStamp into the StartTimeStamp field with a simple:

                    Set Field [ YourTable::StartTimeStamp ; Get ( CurrentTimeStamp ) ]

                         An OnObjectEnter trigger attached to the field "Comments" fires a script that put a time into the "Start" field; that script is:

                    Set Field [ YourTable::Start ; YourTable::ExerStartTime + ( Get ( CurrentTimeStamp ) - YourTable::StartTimeStamp ) ]

                    • 7. Re: Creating a Simulated Clock
                      pademo57

                           Thanks raybaudi,

                           I've done as you have suggested and it worked perfectly ... until today.  Yesterday it would show in the TimeSession field the time in hours and minutes, but today when I tried it I get a long number that isn't in the format of "hhmm".

                           I tried re-formatting the field TimeSession to show as time with the format of "hhmm", but I am still getting this number.  

                           What have I done wrong?

                      • 8. Re: Creating a Simulated Clock
                        pademo57

                             To raybaudi,

                             Disregard the above. I figured out what I had done wrong.  I made a new button but put in the wrong calculation in the field.  Your answer was just what I needed.

                             Thanks again.