5 Replies Latest reply on Jul 23, 2014 2:55 PM by philmodjunk

    Question on script to go back to previous record if user didn't submit

    terrypink

      Title

      Question on script to go back to previous record if user didn't submit

      Post

           Hi Phil,

           Wondered if you could help me with this question?  I have created a layout that leads to a series of diary questions.  Previously, I had created a script where every time the user logs into the opening menu, they get a new record.  However, the PI is saying that they would  would like it to only get a new record if they press submit, otherwise, if the person is only halfway done and then exits out of the application, then the next time they log in, their previous record would be there waiting for them, and they would also get a dialog box saying that they need to finish their submission.  I’ve been trying, but to no success.  Could you take a look at the screenshot?

            

            

           The problem is that I can’t use the “Set Field [DailyDiary::fkBEAMStudyID; Get (AccountName)]” code until after a “New Record/Request” line, otherwise it doesn’t work (nothing seems to get populated into the DailyDiary::fkBEAMStudyID field).  I tried “Go to Field” instead, but that didn’t seem to work.  Without linking the DailyDiary::fkBEAMStudyID field to the AccountName, it just pulls up the last record of the last user that logged in, not the user that logged in this time.

      2.JPG

        • 1. Re: Question on script to go back to previous record if user didn't submit
          philmodjunk

               I'm not sure that I have a complete understanding of your issue, but this sounds made to order for recording all data in a set of global fields. When the user clicks a "submit" button the script can then create a new record and use set field to transfer the data from the global fields to corresponding fields in the newly created record. The global fields can be defined in a different table if that makes managing access permissions easier. (The table of global fields can be fully accessible to all users where the data in the table where you are creating new records may have to limit a user's access to only records that they created.)

          • 2. Re: Question on script to go back to previous record if user didn't submit
            terrypink

                 I'm not sure how this would help, Phil?  The problem I'm having is that I need to use the Set Field command to assign an Account Name to the foreign key?  But this seems to only work once you've already created a new Record?

                  

                 Is there any way to get technical support one-on-one through the phone?  Are there any training packages offered that can do that?

            • 3. Re: Question on script to go back to previous record if user didn't submit
              philmodjunk

                   If no record yet exists, you can't assign a value to a field defined in it can you?

                   With this method, you do not create a new record with this approach until the user enters all the data into the global fields and clicks submit, waiting to create a new record before assigning the account name to a field should not be a problem.

                   PS. I don't work for FileMaker Inc. I volunteer my time here in this forum.

              • 4. Re: Question on script to go back to previous record if user didn't submit
                terrypink

                     Oh, I'm sorry, i just assumed you work for Filemaker because it seems like you answer all the questions.
                     I'm really thankful for your time.

                      

                     The thing is, I'm trying to figure out how to create a layout so that when a person exits out, their data remains in there the next time they log in?  Right now, if I don't use the "New Records" command, then the last person that submitted data is what is displayed, it's not specified to the person that just logged in?

                • 5. Re: Question on script to go back to previous record if user didn't submit
                  philmodjunk

                       It seems like I am getting the needed design requirements one small crumb at a time. Each new detail changes what will or won't work.

                       If you want the user to find the data they entered in a previous session, it must be stored in nonglobal fields in a record. that data has to be committed. You may want to add a text field that records the record's status. Instead of "committing a record", change the value in this field to "complete" or some other value of your choosing.

                       You can then set up a text field to auto-enter the account name and set up access privileges that limit a user's access to only records with their account name. These same settings can, if desired, prohibit deleting any records except those created by the current user which are not yet marked "complete".