As you've noted, you're overwriting any existing comments when you enter the current time. You could instead use these two steps:
Set Field [Dispatch::Remarks; Get ( CurrentTime ) & " " & If (not IsEmpty (Dispatch::Remarks) ; ¶ & Dispatch::Remarks)]
Set Selection [Dispatch::Remarks; Start Position: Length (GetValue (Dispatch::Remarks; 1) ) + 1]
These add the current time to the start of the field while preserving anything in there already, then set the cursor to immediately after the time on the first line so you can start typing your remarks.
Hope this helps, there are no doubt other ways to do the same thing, but this should get you started.
I need to be able to use a button to append new comments as they come in from the deputy in the field starting with the time the comment came in.
It would be best to create a new record in a related table for each comment. This will also allow you to use a separate field for the time/timestamp.
Sent from my iPad
11th Hour Group Pty Ltd
The only problem I would have with it is the remarks would have to be referenced to the case number created for the call. If I used another table it would be harder to retrieve all the comments for the unique case number.
Sent from my iPhone
Well no, that is not a problem. The case number would be the foreign key for the note table.
If you enter the comments directly into a portal placed on a layout of Cases, the case number will be automatically populated for each new comment you create through the portal. If you prefer to use a dedicated layout, have your "New Comment" button do something like:
Set Variable [ $caseID ; Cases::CaseID ]
Go to Layout [ Comments ]
Set Field [ Comments::CaseID ; $caseID ]
Go to Field [ Comments::Text ]
And if entering new records through the portal, you must check 'Allow Creation' in the relational dialog on the Notes side. :^)
I, too, agree that that you should normalize your data. However, if for whatever reason that's not a viable option you may want to review an older technique on adding a timestamp to your notes field along with the new comments. Search on Matt Petrowski's site for something called Auto Notes. I think it was from a few years back.
Another gotcha for portal-based entry: you might want to restrict editing and deletion based on time elapsed from creation TimeStamp so that users can view but not edit comments which have been posted for over ##-seconds/minutes so that inadvertent editing of existing posts is avoided.
Of give them a 2-portal option. One which shows only the last (blank-creatable) record row, for posting a new comment; another portal below it with no editing access to fields to show existing comments with latest at top. This system is often used to assure that new antries are made at the top, and immediately drop down to the next row with a new blank row at the top ready for the next entry.
Portal filtering can also be used to acchieve this, but it's not necessary for this to be workable.
Thanks for everyones input on this one. Sorry for waiting so long on getting back to reply. Been out of town with no computer for the holidays. Matt I used your script and it works as I needed it. Thanks again to all that replyed.