Why not keep the timstamp and user data in fields separate from the comment field? That enables you to search and sort by timestamp and/or user(account?) names.
Set Field [YourTable::Comments ; YourTable::Time Stamp Type Box & " " & Get (accountName ) ]
will set the comments field to this value. There are also ways to append it to the beginning or end of data already present in this field if that's what you want, but I don't recommend that you use such a method for logging comments.
So phil are you suggesting two seperate boxes next to each other... Past the comment on comments and time stamp in another box next to it?
The time stamp and user name fields can be set up with auto-enter setting to automatically enter the current user or account name and the current time stamp when the record is created or when the record is modified if you find that useful.
You can also set up a table of related records so that you can log multiple comments in these three fields should that be needed.
How do i go about doing what you suggested up top with the set field. I did what you stated on the 2nd post and put it in a script for the button however it doesnt come out well lol.Here look
Also i dont want it to keep overwriting the data in the comments field. How do i get it to make a scrolling list?
Please post what you used for Set field.
When Setting up Set Field, there are two Specify buttons that must be clicked. To get Set Field [Table::Field ; Expression], add set field to your script and click the first button (specify target field). Select Table::Field from the list of fields. Do not click the specify button next to the repetition box. Click OK to close this dialog box. Now click the lower specify button (calculated result) and create the expression to the right of the semicolon (;). Do not try to type in the semicolon.
How do i get it to make a scrolling list?
I wouldn't use a single field for that. As I have already suggested, I'd use a portal of related records. I wouldn't use any button or script for this, the user can create new related records and enter data as needed simply by typing in the fields in the portal. If you have not used a portal before, look it up in help to learn more as this is a very frequently used design element in FileMaker Pro databases.
Set Field [YourTable::Comments ; List ( YourTable::Comments ; YourTable::Time Stamp Type Box & " " & Get (accountName ) ) ]
Will append new text to the bottom of the field.
Set Field [YourTable::Comments ; List ( YourTable::Time Stamp Type Box & " " & Get (accountName ) ; YourTable::Comments ) ]
Will insert it at the top.
Phil Here is what i did. I got it to work. Im sure my method on the scipt is a little weird but it does work. Look at what i did. Maybe you can give me some pointers. Thanks.
What i did was made a new table for the client profile records. Inserted a portal window on the client profile layout. A user types in what it is they would like to post in the Time Stamp Type Box. Then presses Stamp. Here is a screen shot of my script.
Looks good to me, but do you still need the box and button at the top? If "allow creation of records via this relationship" is enabled, you can log comments in the portal row simply by entering a comment in the bottom blank row of your portal.
On the other hand, there are ways to use your setup to add new comments and make them the upper most row in the portal...
Here is my end result.
Thats an idea to. Then i wouldnt have to jump around back and fourth between layouts. Ill try it. Thanks Phil
Your script hadn't yet appeared when I made my last post.
Your script should be modified to avoid using copy/paste like this. There are better options. (Copy will destroy any data the user has previously copied to the clipboard so this script can inconvenience and confuse your users when they discover that this data disappears each time they click the button.
Write your script like this:
Set Variable [$ID ; ClientProfile::__PkClientID]
Go To layout [//your layout here
Set Field [Client Profile Time Stamp Records::__PKClientID ; $ID ] //this field should really be neamed _FKClientID for foreign key
Set Field [Client Profile Time Stamp Records::Comment ; ClientProfile::gTimeStampTypeBox]
Go to Layout [original layout]
Give your time stamp type box global storage--a better option here and you don't need to use a variable like we did for the ID number.