I have a layout. The layout is in browse mode. But I want 2 of the fields to be display only.
How should go about it. is it setfield....?
It depends what exactly you mean.
If you want the fields to simply be inaccessible on one or more specific layouts, you can use the Inspector (Data tab) to turn off Field Entry in Browse mode, for the layouts in question.
If you want the fields to be editable only via script (regardless of the layout), then you could consider turning on the checkbox option in the Auto-Enter tab of the Field Options dialog to "Prohibit modification of value during data entry". That will prevent direct manual editing of the field, but won't stop its value being updated by script or button commands.
There are a bunch of other options available if neither of the above meets your needs, but hopefully that gives you a place to start.
R J Cologon, Ph.D.
FileMaker Certified Developer
Author, FileMaker Pro 10 Bible
NightWing Enterprises, Melbourne, Australia
As Ray warned, scripts and button-driven script steps can edit fields which are not calcs, even in some cases where the prohibit modification during data entry setting is enabled in the field definition options.
That can come as a big unwanted "feature" if you think you have protected auto-entered data stored as a regular text/date/number. Think about Primary Key fields...
This bit me once when I forgot to test the window mode within a script and programmed the script to set a primary key field thinking it would be in Find mode. It was actualy still in browse mode, and it changed the "uneditable" auto-entered primary key of the current record instead of hunting for another record!
If you want the field to be display only in find mode as well as in browse mode, you could consider using a merge field instead of a regular field.
(Please excuse me if I've misunderstood what you're asking for.)
Retrieving data ...