11 Replies Latest reply on Aug 23, 2013 10:54 AM by NicoleHicks

    Timestamp puzzle...

    FMNewbie

      Title

      Timestamp puzzle...

      Post

      (Using FM Pro 11; Mac OS Snow Leopard)

       

      Okay... on a layout I have, I want to create a sort of table with a list of text entries in one column, and a timestamp for each entry in another column. Something like this:

       

           TIME    TEXT

           13:00    Got up

           13:10    Made coffee and went for a walk

                        and bumped into Bob.

           13:30    Checked mail.  No bills.  Yaaaay!

       

      (No... I don't have OCD, it's just an example).  What I have so far is 2 fields (lets call them TIME and TEXT as above) each set up as a repeating field with say max 10 entries. TIME is set to a calculated result using:

       

            Evaluate ( "Get ( CurrentHostTimeStamp )" ; TEXT )

       

      Because this gets a new timestamp every time something is changed, it only returns a timestamp in the first entry in the TIME list, but nothing for subsequent entries.  So with that in mind I have 2 questions:

       

      1.  Is there a way to place new sequential timestamp entries in TIME each time a new sequential entries are placed in TEXT?

      2.  Is there a way to have the size of the TIME entry change in relation to the TEXT entry as in the above example at 13:10?

       

      Thank you. 

       

       

       

       

       

       

       

       

       

       

       

        • 1. Re: Timestamp puzzle...
          fitch

          Have you considered making a new record for each time-stamped entry? This would give you much more flexibility and simplicity. Repeating fields have certain utility usages, but in general should be avoided for data storage.

          • 2. Re: Timestamp puzzle...
            philmodjunk

            Expanding on Fitch's suggestion

             

            With a separate record of two fields for each entry (one for time stamp and one for the text entry) you can set an auto-enter option on the time stamp field to auto-enter the creation time stamp and that will fix the issue you are describing here.

            • 3. Re: Timestamp puzzle...
              FMNewbie

              Hmm... both good suggestions but I'm afraid I need a way to do this all on one record. 

              • 4. Re: Timestamp puzzle...
                LaRetta_1

                Why?

                • 5. Re: Timestamp puzzle...
                  ninja

                  Seconded...Why?

                   

                  The design in your original post is a portal of related records waiting to happen.  Then Timestamping becomes a breeze with an autoentered timestamp on record creation.

                  • 6. Re: Timestamp puzzle...
                    FMNewbie

                    The text field in question is a notation log for patient care, and every entry in the log has to have a time the observations were made.  I'm just trying to save the user from having to type in the time every time they want to make a note. 

                     

                    Another thought.... is there a way to set up a button object to INSERT a timestamp into the text field?  ie without overwriting what's already in the text field?? 

                     

                    Thanks for the feedback.

                    • 7. Re: Timestamp puzzle...
                      LaRetta_1

                      You are not listening to advice from several Developers.  You really should.  We understand EXACTLY what you have and what you want to do.  And we are ALL highly recommending that you proceed a different way.

                       

                      You have a patient table.  I hope you  have a field called PatientID (number, unique auto-enter, FM-generated incrementing serial number).  If not, put one in now. If you have existing records, you will need to populate the ID.  If you need help with this, let us know.

                       

                      Then create another table called NOTES with four fields:

                       

                      NoteID (number, auto-enter serial)

                      PatientID (number left empty)

                      Timestamp (auto-enter creation timestamp)

                      Note (text)

                       

                      In your graph, join the two table occurrences as:

                       

                      Patients::PatientID = Notes::PatientID

                       

                      ... and at the bottom in this dialog, check 'allow creation of related' on the NOTES side.

                       

                      Place a Notes portal (Insert > Portal) on your patient form.  Inside the portal place two fields:  Creation Timestamp (turn off entry to the field or use merge field instead so users won't change it) and place your notes field.  Now every time you want to create a note for the patient, just click into the next blank row in your notes table and the time will insert automatically when the User begins to type.  

                       

                      This may seem more complex but we assure you, it isn't.  And you need to understand relational and NOW is the time for that to happen.

                       

                      • 8. Re: Timestamp puzzle...
                        FMNewbie

                        I think I actually understand that... I must be catching on to this stuff.   I'll give it a try!!

                         

                        Thanks for the help.

                        • 9. Re: Timestamp puzzle...
                          FMNewbie

                          LaRetta...

                           

                          Okay, I followed your instructions (thank you) and I now have a better understanding of what I'm doing and I managed to get it to work like you described... the timestamp auto enters when you type in the field beside it... however as soon as you click out of the portal, everything disappears.  This is probably something simple I'm not doing... any thoughts??

                          • 10. Re: Timestamp puzzle...
                            FMNewbie

                            Good grief... never mind... figured it out. 

                            • 11. Re: Timestamp puzzle...
                              NicoleHicks

                                   Insert TImestamp Without Overwriting Field Contents

                                    

                                   To add a timestamp that doesn't overwrite the information in your text field....

                                   1)Go to Manage Scripts

                                   2)Select the script you want to use or make a new script

                                   3)Under the "Fields" section is an option called "Insert Calculated Results". Add that to your script.

                                   4)Below the window is a little section labels "Script Step Options". Uncheck the box labeled "Select entire contents." That's what will let you insert the timestamp without overwriting everything in the field.

                                   5)Specify your target field to assign the field where the timestamp will appear.

                                   6) Specify "Calculated Result" by going to the "Get Funtions" and selecting "Get (Current TimeStamp)"