1 2 Previous Next 16 Replies Latest reply on Jun 22, 2011 2:03 PM by philmodjunk

    Setting Table View As Read-Only

    RonKanter

      Title

      Setting Table View As Read-Only

      Post

      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?

      Thanks,

      Ron

        • 1. Re: Setting Table View As Read-Only
          philmodjunk

          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.

          • 2. Re: Setting Table View As Read-Only
            RonKanter

            Phil,

            Could you give me a little more detail on the second option using managed->security?

            Thanks,

            Ron

            • 3. Re: Setting Table View As Read-Only
              philmodjunk

              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.

              • 4. Re: Setting Table View As Read-Only
                RonKanter

                Thanks.  I'll try playing around with this.

                • 5. Re: Setting Table View As Read-Only
                  RonKanter

                  Still no luck getting this to work.  I understand the logic, but can't seem to get it to work.

                  • 6. Re: Setting Table View As Read-Only
                    philmodjunk

                    "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.

                    • 7. Re: Setting Table View As Read-Only
                      RonKanter

                      Phil,

                      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.

                      Thanks,

                      Ron

                      • 8. Re: Setting Table View As Read-Only
                        philmodjunk

                        Check your inbox for a private message.

                        • 9. Re: Setting Table View As Read-Only
                          RonKanter

                          Phil,

                          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?

                          Thanks again,

                          Ron

                          • 10. Re: Setting Table View As Read-Only
                            philmodjunk

                            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.

                            • 11. Re: Setting Table View As Read-Only
                              RonKanter

                              Since the layout is read-only does it matter where the field comes from?

                              • 12. Re: Setting Table View As Read-Only
                                philmodjunk

                                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.

                                • 13. Re: Setting Table View As Read-Only
                                  RonKanter

                                  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. 

                                  • 14. Re: Setting Table View As Read-Only
                                    philmodjunk

                                    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.

                                    1 2 Previous Next