Setting Table View As Read-Only
We have FM Pro 11 and I would like to set the table view to read-only so the user have to use the from to edit or create new records. Is this possible?
Do you want to prevent table view as view option all together or do you have two layouts--one for table view and one for form view?
In layout setup... you can clear the table view check box and then users can no longer select table view.
To make a layout used with table view "read only" takes one of two approaches:
Put all the fields on the layout (don't use the modify button). Select them while in layout mode and use the behavior settings in the inspector to prohibit field entry while in layout mode. This prevents editing in all the fields on the layout no matter what view mode you are in.
Use Manage security to set up a lock expression based on a global text field. Use a script trigger to set change the value of this field when the view is changed so that all records are locked from editing whenever the user specifies table view.
Could you give me a little more detail on the second option using managed->security?
First it requires that your users are opening the file with passwords that do not have Full access privileges.
THen, in their privilege set setting, you set up Custom Privileges for Records, Select the table for this layout. Select "limited" in the Edit drop down for this table and enter a "lock expression" such as: gLayoutStatus ≠ "Table".
Define gLayoutStatus as a text field. Use a script like this to change the value of gLayoutStatus to permit/forbid editing data while in Table View:
If [ Get ( LayoutViewState ) = 2 ] Set Field [YourTable::gLayoutStatus ; "Table" ]else Set Field [YourTable::gLayoutStatus ; "Form"]End If
You can use the layout script triggers: OnViewChange and OnLayoutEnter to perform this script when they first access the layout and any time the user changes the view. If you have multiple layouts in your file that also display data from the same table, you will need to use at least an OnLayoutExit trigger to unlock this table on those layouts or your data on those layouts will be locked/unlocked depending on the view state current when the user exits that layout.
Hmmm, haven't tested this last minute idea, but you may be able to avoid script triggers if you define an unstored calculation field, cViewState, with an expression such as Get ( LayoutViewState ) and then use cVewState≠2.
Thanks. I'll try playing around with this.
Still no luck getting this to work. I understand the logic, but can't seem to get it to work.
"Can't seem to get it to work" does not give me anything to go on.
If you described what you did and how it failed to work, I might be able to provide more detailed direction to help you.
Do you do any consulting work? There are actually several issue I am trying to solve and don't that much time to get them done.
Check your inbox for a private message.
I thought I had the security working, which I do, but it created a problem. On my view only list view I have one drop down list field that allows the user to filter the result set. It is basically a list of employees. When the user selects an employee only the relelvant records are displayed. The problem is that when I make the view read-only I can no long change the value on that field. Any other way to do the drop down list box that is populate from a value list?
Make the drop down a global field defined in a different table that isn't restricted to read only. You can access global fields defined in any table from any layout in your file without needing to define a relationshp to that table so this shouldn't be hard to set up. I often define a table reserved just for managing all global fields except for those used in relationships just to make it easier to keep track of them.
Since the layout is read-only does it matter where the field comes from?
You can't make the layout read only, you are making the layout's table read only when it is in table view. Thus, fields from other tables added to this layout will not be affected by this change unless you set them up with lock expressions in Manage Security as well.
Let me clarify. I created two layouts, one with a form view and with with a list view. I basically want users to use the form view layout when entering or editing data.
And what method did you use to make the second layout read only?
The only methods that I can think of either lock each field in that view by changing the behavior settings in the Inspector or you use a lock expression in Manage Security to lock the table.
Yeah, that won't work here. You could add a button that pops up a small window or custom dialog for them to use for this purpose, otherwise, you'll need to do one of the following:
Set a lock expression you can use to lock the table instead of the layout.
Put all the fields on the layout while in layout mode, select them all and use Behavior to deny access to the fields while in browse mode, then add your drop down list field to the header without this option selected to deny access.
Retrieving data ...