November 28, 200619 yr I have a notes field that is a simple text field. I have created a script to add a new note with date, time, and user name. Now the users of this database have asked if the entries can be placed at the top of the notes so the notes will always be sorted from most recent to oldest. Is this possible? If so, what would I need to add to my script?
November 28, 200619 yr Do you have a separate field for the new note to be added, or do you just want to insert the cursor after the Date/Time/Username?
November 28, 200619 yr Author Do you have a separate field for the new note to be added, or do you just want to insert the cursor after the Date/Time/Username? All notes are in the same field. I just want to insert the Date/Time/Username/Cursor at the top of the filed instead of the bottom.
November 29, 200619 yr I think: Set Field[YourField; "NewText" & {Pilcrow} & YourField] Should work in your script. Note that the "{Pilcrow}" is the new paragraph symbol. Although I'd go for a separate Notes table and store each note as a separate record with timestamp, user and data fields. A portal sorted in date descending order then accomplishes the users' request... David
November 29, 200619 yr Start -- Run -- charmap will let you choose screwed up characters - like pilcrow - on xp.
November 29, 200619 yr Author I think: Set Field[YourField; "NewText" & {Pilcrow} & YourField] Should work in your script. Note that the "{Pilcrow}" is the new paragraph symbol. Although I'd go for a separate Notes table and store each note as a separate record with timestamp, user and data fields. A portal sorted in date descending order then accomplishes the users' request... David I tried Set Field. When I chose specify calculated result and entered the following: WiSARD_Billing::Notes; "NewText" & ¶ & WiSARD_Billing::Notes I got this message when trying to save. An operator (e.g. +, -, *, ...) is expected here.
November 29, 200619 yr In the Set Field[] statement, the first argument (everything in front of the semicolen) is the target field. The calc is everything after the semicolen. But Set Field[] alone will not put the cursor after the newly inserted text. You might try it this way: Set Variable [ $text ; getastext(get(currentdate)) & " " & getastime(get(currenttime)) & " " & Username & ": " ] Set Field [ WiSARD_Billing::Notes; $text & ¶ & WiSARD_Billing::Notes ] Set Selection [ WiSARD_Billing::Notes; Start Position: length($text) + 1; End Position: length($text) + 1 ]
November 30, 200619 yr Jim-- You got that error because I gave you an error. The pilcrow (Start->Run->CharMap is too much out of my way, thanks anyway genx ) should be enclosed in quotation marks. Putting quotation marks around it will fix the error. And if you DO need to put the cursor at the end of the new note, Ender's approach will work. But consider splitting this info out into a separate table; it really gives you a lot of other options (like testing how many notes got added on a given date, or how many notes each staff member has added, etc.)... David
November 30, 200619 yr Good news: in FM7 and later, the quotes are not required around a ¶ in a calc. But consider splitting this info out into a separate table; it really gives you a lot of other options (like testing how many notes got added on a given date, or how many notes each staff member has added, etc.)... I totally agree. It's also useful to be able to have different properties (fields) on each note, so they can be sorted, filtered, and summarized in different ways.
Create an account or sign in to comment