Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×
The Claris Museum: The Vault of FileMaker Antiquities at Claris Engage 2025! ×

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

Recommended Posts

Posted (edited)

I'm not sure if this post belongs to Define Fields or in Accounts & Privileges. So I'll just post it here first.

I'm currently creating a clients table and one of the features requested was that the field Comments cannot be modifiable after it is created. I created a Comments table since a client will have many comments.

The portal for comments works but users can always go back to the previous comment and modify it. This is where I am stuck.

I tried using a merge field instead of edit box but then I can't add comments

Edited by Guest
Posted

Why not have a global field where the user can enter comments and then press a button to add the comments. Once it adds it to the related comments table, The portal can show these related records. On your relationship, make sure that 'Allow Creation on Records..." is unchecked

Posted

It doesn't work as I want it to be. Even if I uncheck the "Allow creation of records" checkbox, the users can still modify the comments. If I use merge field, they can't but I wouldn't be getting the scroll bar feature either.

Posted

'Allow creation of related records' merely prevents a blank portal row from being displayed at the bottom of the existing ones. It is not relevant to allowing or disabling modification of a field.

It is probably easiest to create a calculation field in the related table equal to yourFieldName. Then put this field in your portal. It will not be modifiable, and you can scroll in it if you allow access to it in Browse Mode via Field Behavior.

Posted

First of all, I'd like to thank you all for taking the time to help me.

'Allow creation of related records' merely prevents a blank portal row from being displayed at the bottom of the existing ones. It is not relevant to allowing or disabling modification of a field.

It is probably easiest to create a calculation field in the related table equal to yourFieldName. Then put this field in your portal. It will not be modifiable, and you can scroll in it if you allow access to it in Browse Mode via Field Behavior.

Doesn't this solution only allow me to display one field. I need to display the last 5 comments per client.

Posted (edited)

SBG2, you did exactly (well almost) what I needed! What I didn't know was how to lock the field and by looking through all the menus, I found the Field Behavior where you unchecked Browse mode. That actually keep the user from being able to modify it.

I have provided a graphic for a button so I will modify your script and implement it, if you don't mind. B)

Thank you!

Edited by Guest
Posted

Doesn't this solution only allow me to display one field. I need to display the last 5 comments per client.

No, the calculation is in the related table. So it will display as many comments in the portal from the main table's layout as there are records in the related table.

The Custom Dialog solution is clean, but it still does not allow you to scroll through the field. A combination of the two solutions seems to satisfy the requirements though.

See modified attachment.

contactv2.zip

Posted

Is it possible to attach a button to a portal row which will perform a script to establish whether the comment field in that row is empty or not. If it is empty the script can then open a new window showing the related comment field and allow access, otherwise display a warning that the existing comment can not be modified?

Posted

Another thing you can do is in your define fields set it the field to auto enter on creation. Put nothing in and mark the box to prevent modification. This requires changes to be scripted.

Posted

Jonmuk, try using the script below, with contact::ID_Contact as the button's script parameter (or use a script variable, if you prefer).

Freeze Window

Allow User Abort [Off]

If[not (lsEmpty(comment::ID_Comment) or IsEmpty(TrimAll( comment::Comment; 0; 0)))]

Show Custom Dialog[Title: "NOTICE"; Message: "You cannot modify this comment.”; Buttons: OK]

Else If [isEmpty(comment::ID_Comment)]

Go to Layout [comment (comment)]

New Record/Request

Set Field [comment::ID Contact: Get(ScriptParameter)]

Go to Field [comment::Comment]

Pause/Resume Script [indefinitely]

Go to Layout [original layout]

Else

Go to Related Record [From table: comment: Using layout: comment (comment)] [show only related records; New window]

Go to Field [comment::Comment]

Pause/Resume Script [indefinitely]

Close Window[Current Window]

End If

Posted

There is one little thing that bugs me is that I cannot have a scroll for each comment. Some comments can be longer than the given size. In my layout I had set it to 5 lines and show the last 5 comments. That's about all the room I can spare, sometimes 5 lines isn't sufficient and the comment gets cut off.

Posted

Double Click on the field in layout mode and select the the button "Included Vertical Scroll bar"

Posted

It is already checked. The scroll doesn't work when you uncheck Allow field to be browsed: "in Browse mode" for the field's behaviour. Could this be a bug?

I had to leave it uncheck so users can't modify it.

Posted

Actually, I think that is the expected behavior when you deny them access to the file in browse mode.

Instead, use the Accounts an Privileges to set the field to No Editing etc.

Posted

Also, if there is no good reason to sort/find the individual comments later, you can store and timestamp them directly inside a record with two fields. This is a popular logging technique and lends itself to many applications.

Here's the steps:

1) Create two TEXT fields in exactly this order. I repeat exactly this order...

a) NoteLog

: NewNote

Then go to NoteLog, open the options and set it to :

- Auto Enter Calculation

- PREVENT Modification

- Calculation Replaces Existing Contents

The calculation will be:

Case(NewNote; Get(CurrentDate) & " - " & Get(AccountName) & " - " & NewNote & pilcrow** & NoteLog ; NoteLog)

**the pilcrow is the paragraph glyph available in your calculation dialog box

Then go to NewNote and set it to

- Auto Enter Calculation

- ALLOW Modification

- Calculation Replaces Existing Contents

The calculation will be:

Case(Notelog; "")

Now place both fields on your layout. Make them both enterable and make the NoteLog field large enough to show several lines of text. Show the scroll bar too. Make sure that the layout is set to save changes automatically.

Type something into the NewNote field and exit the field by your preferred method. The NoteLog field should nicely log your entry with a date stamp and your login account name. You can modify the auto enter calculation to include any tracking data you like as long as it can be pulled from within the calculation. Nobody will be able to modify the NoteLog field but you can search it, select it, and copy data from it without any hassles.

There are hundreds of possible variations on this concept that can vastly extend the power of a user interface, not the least of which is to create an automatic log of activity and changes to the data using other calculations to get the contents of NoteLog.

I do not know who originated this trick, some credits for my learning experiences go to:

La Retta

Database Pros

Ray Cologon

Is this the best solution for your purpose? I have no idea, it's just another way to set up a linear note log. You will also need to play with it to get a sense of what you can do and how to make your particular needs fit into the model.

This topic is 7007 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
×
×
  • Create New...

Important Information

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