7 Replies Latest reply on Aug 4, 2014 1:24 AM by symbister

    Notes Field Question

    TedHouser

      Title

      Notes Field Question

      Post

           I have created a Notes field and scripted it to automatically put in, UserName, Date, & Time every time they click inside it. Then they can add their notes so that they know, who and when the note was written.

           Is there a way to have it always show the most current 'dated' note at the top with a return space after each note entered?

           Example of what I would like it to do and look:

           tedhouser - 7/24/2014 - 4:51:02 PM - Sent email.

            

           tedhouser - 7/24/2014 - 4:50:01 PM - Called back manager was not in.

            

           tedhouser - 7/24/2014 - 4:49:29 PM - Made a call, told to call back

            

            

           Right now it leaves the first note entered at the top, and when they click on that field again it places the new info directly after the last note entered

            

           Example of what it currently does:

            

           tedhouser - 7/24/2014 - 4:52:52 PM - Made call, said to call back tedhouser - 7/24/2014 - 4:53:09 PM - Manager was not in tedhouser - 7/24/2014 - 4:53:18 PM - Sent email

        • 1. Re: Notes Field Question
          raybaudi

               Hi

               you can solve your problem using two triggers on the same field, OnObjectEnter and ObjectExit, each one firing the appropriate script below:

          ONENTER
               
               Set Variable [
          $$notes ; Value: Get( ActiveFieldContents ) ]
               Insert Calculated Result [
          Select ; no field name here ; Get ( UserName ) & " " & Get ( CurrentTimeStamp ) & " - " ]

          ONEXIT
               
               If [
          Get ( ActiveFieldContents ) ≠ GetValue ( $$notes ; 1 ) ]
               If [ Right ( Get ( ActiveFieldContents ) ; 3 ) ≠ " - " ]
                  Set Field [no field name here ; Get ( ActiveFieldContents ) & ¶ & $$notes ]
                   Else

                 Set Field [ no field name here ; $$notes ]
                   End If
               End If

                

                

          • 2. Re: Notes Field Question
            philmodjunk

                 Or you can set up a portal to a related table and enter each note into a different record with separate fields for the UserName, Date, Time and Note text. Your portal can be set up with a sort order that sorts the most recent note entry to the top of the portal. No scripting needed.

            • 3. Re: Notes Field Question
              TedHouser

                   Sorry for not getting back to you guys sooner.

                   I am still trying to figure this out, I am not to savvy so when i tried the two examples above neither worked and I am certain it is user error, meaning me.

                   So I have "Main Notes" Script:

                   Insert Text [LGBT::Notes:; " "]

                   Insert Text [LGBT::Notes:; " "]

                   Insert Calculation Result [LGBT::Notes; Get ( AccountName ) & " - " & Get ( CurrentTimeStamp )]

                   Insert Text [LGBT::Notes:; " "]

                   When people enter notes it looks like the Image attachment, which is fine.

                   What i would like it to do is show all entries with the most current dated entry at the top. So each time someone added a new note, it shows the most current entry at the top all the time.

              • 4. Re: Notes Field Question
                philmodjunk

                     No scripting at all is needed if you use a portal to a notes table and use a portal sorted on the timestamp field to show the latest note as the top entry.

                     user names, account names and a creation time stamp can all be auto-entered via auto-enter field options in Manage | Database | Fields.

                     Though you might add a new note button to save having to scroll the portal to the end each time that you need to add a new note record:

                     If your relationship looked like this:

                     LayoutTable::__pkLayoutTableID = Notes::_fkLayoutTableID

                     then your script for a new record might be:

                     Set Variable [$NoteID ; value: LayoutTable::__pkLayoutTableID ]
                     Go to layout ["Notes" (Notes) ]
                     New Record/Request
                     Set Field [Notes::_fkLayoutTableID ; $NoteID ]
                     Go to Layout [Original layout ]

                • 5. Re: Notes Field Question
                  TedHouser

                       The scripting works perfectly, thank you raybaudi!

                       My only question now is:

                       Can I still make it so that they can scroll through the note entries?

                       Some of the notes fields may get pretty long as they keep entering new ones and when i tested it, it kept the most current entry at the top but as i kept making entries i would loose the first few as they were pushed down and it would not allow me to scroll anymore.

                       Again, thank you to everyone who has replied!

                  • 6. Re: Notes Field Question
                    raybaudi

                         "Can I still make it so that they can scroll through the note entries?"

                         I don't see why not. The Notes field must have a vertical scroll bar.

                    • 7. Re: Notes Field Question
                      symbister

                           suggest that you reconsider Phil's solution as it is more adaptable to other scenarios  - and portals have the added advantage of filtering / sorting within the portal, so that you could also sort by date, then user etc.