11 Replies Latest reply on Sep 21, 2012 8:27 AM by nsabel

    creating a next button for the same record

    zubir007

      Hi,

       

      I am trying to create a next button on my layout that when I I start up my database from the beginning and I click on new patient it automatically creates a new record (which I had no problem doing)....then after I finish entering the data in that layout I goclick on the next button and it takes me to the next layout that I need to go to but I have to click on new record again to enter data and I dont nwant to do that. I want to make it the same record for the same individual like link it up. Can someone please give me step by step directions on how to do this. I would really appreciate it. It is a project for school and I am having a very difficult time doing this. Thank you.

       

       

      Regars,

       

      zubir007

        • 1. Re: creating a next button for the same record
          beverly

          z, does your button call a script or a script step (i.e. New Record)? if it's a script, you can PASS a parameter to the script in the button. Something like if the ID or name or several fields are completed. Then go to the next layout (or wherever). If you test for the values that already entered in the next "form" (layout) and these are complete (or you check a "completed" flag field), you can then branch your script to get the correct value as the parameter and perform the New Record (as the last one is "complete"):

           

          BUTTON (on button on main layout):

               Perform Script

                    "MyScript"; Parameter: If ( completed // this record; 1 ; 0 )

           

          SCRIPT:

               MyScript

                    If ( Get ( ScriptParameter ) = 1 )

                         New Record

                         ....

                         Exit Script

                    Else

                         Go to Layout ("myNextLayout")

                         ....

                         Exit Script

                    End If

           

          (very rough outline of the script)

          Beverly

          • 2. Re: creating a next button for the same record
            zubir007

            Hi,

             

             

            Could you be a little more specific because I tried doing that but it didn't work for me. I think I am understanding you incorrectly. 

            • 3. Re: creating a next button for the same record
              nsabel

              I took a look at your file and this is a little bit more than a simple step by step fix on a script. The problem is in the structure of the tables and in the relationship graph. My first recommendation is to go to the Filemaker help and then do some reading in the designing and creating databases section. The first thing you will want to do is figure out how many tables you need and how they are related.

               

              For Example:

              You may have a table called person and in this table you will have fields like person id, first name, last name... and so on. All of those fields relate to the person. Next you have a table called orders which may have fields like person id, product, date...and so on. You dont need to have the persons name on the order because you can create a relationship between the two tables using the person id.

               

              The Problem:

              In your table definitions you have a table new_patient_layout and another that is new_and_continuing_patient_layout. You dont need to create a talbe for each layout you would instead create one patient table with all of the information on the patient and then make multiple layouts using that single table. Next based on what I see in your file you would have a visits table that would have information on the visit and also a patient id which will be used in the relationship graph to create a relationship between the two tables.

               

              Nick

              • 4. Re: creating a next button for the same record
                zubir007

                Nick,

                 

                 

                I built the relationship how you had mentioned but the relationship didn't fix the problem.  Did I do something wrong?  I have attached the file. 

                • 5. Re: creating a next button for the same record
                  nsabel

                  The structure is better. You have multiple options to make this new record in the related table. Based on your description you want to click a button to make the related record. Note: This will make a new related record everytime you click this button so to view an existing record you need to make the layouts, scripts and so on... The script that would be attached to a button on your patient layout would look like this:

                   

                  Set Variable [$pID; Value:new_patient_layout::Patient ID]

                  Go to Layout ["case_report_forms" (crf table)]

                  New Record/Request

                  Set Field [crf table::Patient ID; $pID]

                   

                  This will create a new record in the crf table and tie it back to the paitent that was being viewed on the patient layout.

                   

                  Nick

                  • 6. Re: creating a next button for the same record
                    zubir007

                    Nick,

                     

                    Ok I will try this out and let you know soon.  How wouldyou do these layouts/tables if u had this project for school.  Basically here is the project for class that I have to do. 

                     

                    As you know the first thing you see is the new patient or follow up patient buttons then once the user clicks on it lets say new patient then they have to fill out a series of forms for the new patient and if they click on follow up patient then they have to choose the patient from a drop down list.  and it would ask what month and so forth it is.  Then it would go to the forms where the user has to fill it them out like vitals, medical history, etc etc.  and there will also be certain forms that only need to be filled out in certain visit like lets say every 3 visits you take their medical history or something, etc.  You get what I am saying?

                    • 7. Re: creating a next button for the same record
                      nsabel

                      Just off the top of my head.

                       

                      Tables:

                      Patient

                           PK = patientId

                      Vists

                           PK = vistId

                           FK = patientId

                      Medical History ( optional this could be part of patient depending on what and how much is stored )

                           PK = medHistId

                           FK = patientId

                      *Note: for the primary and foreign key id fields I would recommend using an auto-enter serial number and must be unique

                       

                      Layouts:

                      Main menu/start page

                           This will contain buttons like new patient, follow up...

                       

                      New Patient

                           Contain all of the fields for a new patient and some kind of validation the info is entered

                       

                      Patient List

                           Use a list page instead of a drop down to select a patient and go to a screen that show details about the patient

                       

                      View Patient

                           Depending on how you set this up it could be your new patient layout or a totaly different layout that will allow your users to view the patient details at a later date. This screen should also be where you put your new vist button. Optionally you could also put a new visit button directly on your patient list layout. Also depending on what you decided for table structure you could put a portal to medical records here.

                       

                      Vist Layout

                           Here is where you will have all of your information about a vist and you could optionally add a portal to the medical records.

                       

                      You will also want a way to view previous vists you can do this with a list based screen similar to the patient list and then do a find based on the patient or you could put a portal on one of your other layouts.

                       

                      Between this basic outline and filemakers help menu you should be able to put something together. First worry about the basics then go back and polish it up later.

                       

                      Nick

                      • 8. Re: creating a next button for the same record
                        zubir007

                        Nick,

                         

                        I am not quite sure what u mean by all this in the senese like pfid and stuff under the tables portion.  But what is wrong with the table formats that I have right now.  If I just keep making relationships between tables I should be fine right?

                         

                         

                        zubir007

                        • 9. Re: creating a next button for the same record
                          nsabel

                          That has to do with primary (PK) and foreign (FK) keys which are used in your relationships. A database can be designed many ways, however it is important to think about database normalization. I realize you do not know what that is and I'm not going to get into any details either. Yes you should be able to make your current tables work. Please take no offense, but I would recommend doing some reading before getting too far as it is clear you don't have the basics down quite yet.

                           

                          Nick

                          • 10. Re: creating a next button for the same record
                            zubir007

                            Nick,

                             

                             

                            Yes you are correct.  I am still learning the basics but I've come a long way in the past feweeks.  I have ordeed the DVD from Filemaker to see how they are and teach me.  Your script worked for me actually.  Do you mind explaining the script that you made.  THank you.

                             

                             

                            zubir007

                            • 11. Re: creating a next button for the same record
                              nsabel

                              Set Variable [$pID; Value:new_patient_layout::Patient ID]

                              Go to Layout ["case_report_forms" (crf table)]

                              New Record/Request

                              Set Field [crf table::Patient ID; $pID]

                              No Problem.

                               

                              Whats going on:

                              When you call this script you are on the patient record that you want to create a related record for in the crf table. The fisrt step sets a local variable named $pID to the value of the Patient ID for the patient record you are viewing. The second step takes you to the case_report_forms layout which has a different table associated with it. Then you create a new empty record in the crf table with the New Record/Request step. Last you use the Set Field step to put the value of your $pID variable into the Patient ID field in your crf table. What makes the relationship work is the value between the crf table patient ID and the patient table patient ID matching.

                               

                              Nick