Jump to content

Add note to top of notes field


This topic is 5781 days old. Please don't post here. Open a new topic instead.

Recommended Posts

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?

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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 ]

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This topic is 5781 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.