5 Replies Latest reply on Aug 19, 2014 9:46 AM by philmodjunk

    How to create a layout that will force the user to finish previous record?

    terrypink

      Title

      How to create a layout that will force the user to finish previous record?

      Post

           Wondered if anyone could help me?  Right now, I have a layout based on a table where if a person presses the "Submit" button, they commit the record and also start a new record.

            

           In addition, I created a script trigger that when the layout is "OnRecordLoad" that a new record is created and the AccountName of the user is set to this record's foreign key.

            

           The problem is that now I have way too many empty rows in my data.  Whenever a user just loads the layout and exits out (even without entering any data), they end up leaving an empty row.  However, without the script trigger on the layout which sets the AccountName to the record's foreign key, the user always sees the last entry of the last participant?

        • 1. Re: How to create a layout that will force the user to finish previous record?
          philmodjunk

               I'd get rid of that script step. You can set up a text field to auto-enter the account name when the record is created and no script is needed. To keep users from seeing records created by other users, use Manage | Security to set up privilege sets that limit their access to just records that they create.

               See "Editing record access privileges" in FileMaker Help and check out this particular sub section: "Entering a formula for limiting access on a record-by-record basis" for a description of how to set this up.

               Then have your script perform a find when the user opens the file or accesses the layout. With record level access control set up via Manage | Security, any find performed by a script or the user will automatically omit records for which they do not have access.

          • 2. Re: How to create a layout that will force the user to finish previous record?
            terrypink

                 How do you "set up a text field to auto-enter the account name when the record is created and no script is needed"?  Is that a calculation?

            • 3. Re: How to create a layout that will force the user to finish previous record?
              philmodjunk

                   It's an auto-enter field option.

                   Find the field in Manage | Database | Fields

                   Double click it.

                   Click the Auto-enter tab

                   You'll then find an option for auto-entering the Account name when the record is created on this tab.

              • 4. Re: How to create a layout that will force the user to finish previous record?
                terrypink

                     Sorry, Phil.  Still stuck.  I created the text field "RecordCreatedBy" to be an auto-enter calculation of "Get(AccountName)"

                     Then I went to Custom Privileges for the Records of that table and under "limited" put the calculation "RecordCreatedBy=True".

                      

                     Then I created a new script called "Perform Find" with just the line "Perform Find[]" and had this script be triggered when the user first enters into this layout.

                      

                     However, I keep getting the error: "The provided find criteria is not valid.  Enter a valid request before proceeding".

                      

                • 5. Re: How to create a layout that will force the user to finish previous record?
                  philmodjunk

                       "RecordCreatedBy=True".

                       Does not seem like the correct expression. RecordCreatedBY = Get ( AccountName ) would allow the current user only access to records where their account name has been entered into this text field.

                       And you need to specify some criteria for your find.

                       Such as:

                       Enter FInd Mode []
                       Set FIeld [Yourtable::PrimaryKey ; "*"]
                       Perform FInd[]

                       When performed when the file is open with a full access account, this script should find all records. For a user that has opened the file with the above posted lock expression in their privilege set, it will find only records with their account name.