1 of 1 people found this helpful
I don't claim to understand the reason it works, but a script using Set Selection as below seems to achieve what you are after:
Set Selection [ Table::Field; Start Position: Left ( Table::Field ; 0 ) ]
To activate the script, set an On Object Enter script trigger on the field, and you will find the cursor goes to the start of the field instead of the end.
Set Selection [ Start: 0 ]
Honestly, it is best to create records instead of using a single field (for many reasons). Here are a few off the top of my head:
- It is easier to search for dates
- You can attach notes to different entities of your solution *simultaneously
- You can prohibit some ding-dong from wiping out the entire field or scrambling the data or pasting garbage into everyone's depository
- You wish to archive older notes but some folks put extra carriage returns like told so you'd know the 'notes' breaks and some didn't and it is now difficult to break them apart.
- If as records, each User can view their own notes in their own related portals (on their Staff records).
- If as records, you can sort by date or by user or by Category or Type.
- You can open a new window to display a single note
- You can print report showing all Client Notes for a single Rep whereever they have note - Invoices, Addresses
- Notes can be kept separate from your main tables so serving up the records remains fast.
The thing is ... why put something together only to require breaking it apart later? As records, Notes can easily attach everywhere with Allow Creation on. *Notes would contain a foreign key from each of your main tables (Contacts, Companies, Invoices, Products) and relate directly to that TO.
1 of 1 people found this helpful
Use the Set Selection script step and set the start position to 0. For entering text into a notes field, I suggest using a button or script trigger to run a script that will insert a tag line at the beginning of the field and then place the cursor at the end of the tag line. Any existing data will be pushed down. Likely better depending on your situation, would be to create a "notes" table and then have each note be an entry in the table. With this, you can have each notes record get automatically date/time stamped, record who created the record, and so forth. Can then perhaps display the notes in a portal on a main view or in a list view on their own. You can then sort the portal or list view by different criteria as needed.
Sample script below that will insert the current date and the name of the person logged into the dB into a general notes field in bold, underline text like this:
15-Mar-2013 - Doug:
# Note that this is kind of old school using the Insert Calculated Result command, but it works assuming the Notes field is on the current layout.
Enter Browse Mode
If [ IsEmpty( Main::Notes ) ]
#"insert" commands leave the cursor in the field at the end of the inserted text.
Insert Calculated Result [ Main::Notes; TextStyleAdd( GetAsText( Day( Get( CurrentDate ) ) ) & "-" & Left( MonthName( Get( CurrentDate ) ); 3 ) & "-" & GetAsText( Year( Get( CurrentDate ) ) ) & " - " & Get( AccountName ) & ":" ; Bold + Underline ) &" "]
#"set field" command does NOT leave the cursor in the field so we need do that with the "set selection" command.
Set Field [ Main::Notes; TextStyleAdd( GetAsText( Day( Get( CurrentDate ) ) ) & "-" & Left( MonthName( Get( CurrentDate ) ); 3 ) & "-" & GetAsText( Year( Get( CurrentDate ) ) ) & " - " & Get( AccountName ) )
) & ":" ; Bold + Underline ) & " ¶¶" & Main::Notes ]
Set Selection [ Main::Notes; Start Position: Position ( Main::Notes ; ": " ; 1 ; 1 ) + 2 ]
Exit Script [ ]
I used the simplest answer, Set Selection [ Start: 0 ]. It does exactly what I was looking for by making it the first line in a script I am already using. But all the answers have information that interests me - and I'm guessing they are all correct. As I become a bit more sophisticated, I'll be coming back to take give more consideration to the more indepth solutions and the reasons behind them.