10 Replies Latest reply on Dec 9, 2016 8:32 AM by erolst

    Navigate through layouts with same record shown

    dsattali

      Hi everybody !

       

      I need a reliable way to do data entry for a medical research project.

       

      For now, i've made a FileMaker project with multiple layouts. Each layout is a form about something different : blood analysis results, or a cognitive test, or "general information about the patient", etc.

       

      I did a main page displaying the serial number called "Patient_ID", and with many buttons to go to the differents layouts linked to that patient.

      This "main" Patient_ID has many options : serial number on creation, prohibit modification during data entry, not empty, unique value, numeric only.

       

      In each layout, there is a field called "Patient_ID", and each of those "Patient_ID" filed is linked to the main Patient_ID with options "allow creation" and "delete records" checked. And those "sub" Patient_ID have only 1 option : "not empty".

       

      And what i need to do seems simple to me even though i can't find any simple solution... Please, do anyone know how can I do to :

      - When I set new record on the main page (= create a file for a new patient), then i can navigate through all layouts to enter data for this patient

      - When i navigate through all layouts, they automatically display information about this patient and this patient only

      - If a layout is already complete for this patient, i cannot over write on those data

       

      The portal solutions would help me if i wanted to display different records in the same layout, right ?

      But i need the opposite, to display only 1 record in different layouts, automatically..!

       

      I tried that but it doesn't seem to work.. Linking layouts

       

      Thanks guys

        • 1. Re: Navigate through layouts with same record shown
          philmodjunk

          It appears that you are treating "layout" and "table" as the same thing. They aren't.

           

          Each layout is based on a table. This is done by specifying a "table occurrence" in the "show Records from" drop down found in Layout setup. A "Table Occurrence" is what we call a "box" in the relationships graph. Each one represents a table, but you can set up more than one occurrence of the same table in order to set up different relationships that link to the same table.

           

          From what you describe, you have based each table on a different table occurrence and each refers to a different table. Using that set up, you will need to write a script that updates each layout to only show records for the current patient. You can either store the Patient ID in a global variable or global field to use to perform a find for the needed record(s) or you can set up a script that always goes to the main "Patient" layout before using Go TO Related Records to both change layouts and to also bring up the related record in that "detail" table. While GoTo Related record can make for simpler scripts for the basic main step, you would then also have to add steps that check for the possibility that there is no related record yet created in that table and if so, to change layouts, create a new record and assign the current Patient ID so at your level of expertise, a scripted find may work better.

           

          You might review this thread of scripted find examples to see how you might set that up: Scripted Find Examples

           

          On the other hand, you could base all of your layouts on the main Patient Table Occurrence and use portals to each of your related tables. This would keep the context the same so that moving from layout to layout keeps you on the same patient record but with the portal showing a different set of related records. If there can be only one related record for a given patient, you can even put the fields from the related table occurrence directly on a layout that specifies your main Patient table occurrence in Layout Setup...

          • 2. Re: Navigate through layouts with same record shown
            BiotechDave

            If I'm reading this correctly then I think I would not use separate layouts but separate tabs on the one layout.

             

            Each tab would correspond to what is now each layout.  If the form on the tab is from related table, then you can either just put the related fields in that tab or, if there is a possibility of one (main page) to many (sub page) then a Portal with only one row and a scroll bar or other navigation aids to move to the next portal row.  Below is a screen shot of how we do it for a contract in our solution.

            Screen Shot 2016-12-08 at 11.22.06 AM.png

             

            Hope this helps

             

            David

            • 3. Re: Navigate through layouts with same record shown
              philmodjunk

              Yes, the same thought had occurred to me as i was finishing an already quite long response.

               

              There can be draw backs as well as advantages to a portal based approach however, so much depends on the needs of the user.

              • 4. Re: Navigate through layouts with same record shown
                dsattali

                philmodjunk : thank you so much, you are absolutely right. I was treating layout and table as the same thing.

                Now I just tried putting all my fields in the same table, seems to work fine.

                With that solution, I don't think i even have to do relationships between tables, nor portals, because 1 patient = 1 "patient_ID" = 1 filemaker record = multiple tests.

                 

                The only bothering aspect is that for each layout i made (for example a cognitive test, or a biological test data input), and to avoid mistakes while doing data entry, i add "not empty" option to almost all my fields.

                And now that they are in the same table, each time i move from one layout to another, filemaker will display "XXX is defined to require value. Allow this filed to remain empty" for each blank fileds (maybe 3 hundreds...).

                 

                Maybe the simplest solution would be to remove the "not empty" option to all my fields and add another securing system : for example an alert pop up when i leave layout A if all fields in layout A are not complete, do you think it is possible ?

                 

                BiotechDave : thanks a lot for your answer !

                But my forms are already quite "heavy", and most of my layouts already have many tabs. I think i'll have around 40 layouts and more than 1 000 fields, so the tab system won't be enough to display something readable.

                 

                Thanks again guys, really appreciate the help

                • 5. Re: Navigate through layouts with same record shown
                  dsattali

                  Hi again !

                   

                  Well i found a nice solution : adding a simple script to my navigation button. If it could help someone one day, here is an example for the button to go back to main screen.

                   

                  If (is empty (all my fields for that layout) )

                  Show custom dialog ("error" ; "blabla" )

                  If (get (lastmessagechoice) = 1)

                  Go to previous field

                  End If

                  Else

                  Go to layout (main)

                  End If

                   

                  That will clearly add robustness to my file, making sure no one miss fields..

                  -> And i don't need anymore the "not empty" option

                  -> So i can use only 1 table for all my fields ..!

                   

                  Thanks again guys

                  • 6. Re: Navigate through layouts with same record shown
                    erolst

                    dsattali wrote:

                    BiotechDave : thanks a lot for your answer !

                    But my forms are already quite "heavy", and most of my layouts already have many tabs. I think i'll have around 40 layouts and more than 1 000 fields, so the tab system won't be enough to display something readable.

                     

                    More than 1,000 fields in what you say is a single table?

                     

                    "Alarm bells, alarm bells, jingling all the way ..."

                     

                    I suspect there are lots of fields called thing1, thing2, thing3 ... etc.? Then your solution is in need of normalization; eg create a table Thing that only has one field thing, and where you can create any number of records.

                     

                    This is (a bit) more complex to set up than just creating numbered fields and placing them on the layout, but will pay off handsomely very quickly.

                    • 7. Re: Navigate through layouts with same record shown
                      dsattali

                      erolst

                      Ahah thanks for the alarm !

                       

                      Yes, for exemple let's say i have a 30 questions "Memory Test" called MEM

                      -> I did put all 30 fields MEM_Q01 ; MEM_Q02 ; etc  in my unique table..

                       

                      What you say to do is a "MEM table", with a unique "MEM_Question" field, where i can create 30 records for each patient.

                       

                      But...

                      - MEM_Q01 could consist of a "0 to 3 choice" , when MEM_Q04 consists of a "0 to 4 choice" ; isn't that a problem ?

                      - How could i display on one layout 3 different questions with 3 different answer box who will be 3 different records ?

                      - I'll then need multiple tables, relationships between them, and even portals i think, right ? So i'm back to my number 1 problem which is the fear to mess between IDs in different tables...!

                       

                      I really have no idea on how i could do such a thing ahah ; i'll start looking here into "normalization"..!

                      • 8. Re: Navigate through layouts with same record shown
                        erolst

                        dsattali wrote:

                        erolst

                        What you say to do is a "MEM table", with a unique "MEM_Question" field, where i can create 30 records for each patient.

                        Yes, you'd put in a set of 30 (or any other number) questions - records - for that patient for that session/visit.

                         

                        But this goes beyond normalization into 'questionnaire territory'. Consider:

                         

                        Patient --< Session --< QuestionSet --< AnswerToQuestion >-- QuestionInTemplateSet >-- TemplateSet

                         

                        (Plus a few other tables, of course Question itself, and eg QuestionType.)

                         

                        TemplateSet is the "original" questionnaire, and QuestionSet is a "carbon copy" of it. It's a good idea to sometimes take a step back and imagine how you would do this without a computer ...

                         

                        Once you have that, you can analyze a patient based on their answers on any level - or you can analyze the answers of all your patients to certain questions, or type of questions - within a date range ... endless possibilities just by having the AnswerToQuestion table

                         

                        dsattali wrote:

                        - How could i display on one layout 3 different questions with 3 different answer box who will be 3 different records ?

                        Use Hide if - which needs a bit of preparation, as you would store the questions in a 'template' Question table, and each question could be of a certain type - which type info you could use to only display the appropriate UI control (checkbox, radio button, edit box).

                         

                        dsattali wrote:

                        - I'll then need multiple tables, relationships between them, and even portals i think, right ? So i'm back to my number 1 problem which is the fear to mess between IDs in different tables...!

                        There is nothing to be afraid of when using internal keys. Give your primary keys an auto-enter method for a meaningless value (serial number, UUID) and validate them as unique and not empty; when you create foreign keys in other tables, make sure they have the same data type as the primary key they will hold.

                         

                        From then on, observe this simple rule: don't touch your primary keys for writing. Don't put them on the layout, or if you do - for debugging, say - don't allow field access. Never let your scripts write into primary key fields, only read them.

                        • 9. Re: Navigate through layouts with same record shown
                          dsattali

                          erolst

                           

                          Thanks for your help..!

                           

                          I just have a few questions about what you explained to me :

                           

                          - do you know where i could find an example of what you describe ?

                           

                          - why do you think this way would be better ? Is it "only" for design purpose (which i completely get) ? Or will filemaker crash if i have a table with 1000 field ?

                           

                          - i ask this because...

                               - in fact, there are 2 kinds of visits, let's call them V and W.

                               - There will be 3 V for each patient, and between 2 and 20 W

                               - Each V is about 20 layouts, with about 30 fields on it --> each V = 600 fields

                               - Each W is about 300 fields

                           

                          So your solution seems perfect in helping to think right and manage so many fields..

                          But i think i'm gonna stick to 20 layouts with my 600 fields for each visit, because the different fields are too different one from the other and i really wouldn't know how to do that so it is "perfect" on the layouts as it is today... and i think i can manage 600 fields.

                           

                          But i would like to "normalize" my different visits.

                          So V and W will become fields, from 1 to 3 for V and from 1 to ?? for W

                          So i'll have a table with Subject_ID and V

                          And another one with V and all my 600 fields

                           

                          Does that seem right to you ? Do you know where i could learn how to do that ?

                           

                          Thanks again,

                           

                          David

                          • 10. Re: Navigate through layouts with same record shown
                            erolst

                            dsattali wrote:

                            [...] 600 fields[...]

                            Does that seem right to you ?

                            [...]

                            Afraid not. 600 is not really progress compared to 1,000.

                             

                            Try to think in discrete entities and how they relate to each other

                             

                            Patient --< Visit (type: W, V) --< Questionnaire (for visitType) --< Questions (for questionnaire)

                             

                            This will also yield quantities that you can programmatically and design-wise deal with - which is not possible with a single monolithic table that sports everything *and* the kitchen sink.

                             

                            Say you have a patient; you see in a portal a list of visits from which you select one; this lets you access the questionnaires (and other data) pertaining to that visit, which in turn let's you list the questions (and answers) belonging to that q.aire.

                             

                            You could manage a patient in a single layout, where you simply switch a pointer to the related records. If you need to create reports, you base those reports on the respective table.

                             

                            dsattali wrote:

                            - do you know where i could find an example of what you describe?

                            Search in this forum for questionnaire; this comes up frequently.

                             

                            I'm afraid I don't have a sample file handy (well, I have one somewhere, but not really handy; you should find something in those posts that'll come up when you search).

                             

                            This entire concept seems complicated, but once you grasp the underlying concept, it all comes together.

                             

                            dsattali wrote:

                            Do you know where i could learn how to do that ?

                            If you're the bookish type: there are general books on the subject; also, all serious FileMaker books I ever read have a section on data normalizing.

                             

                            Then there are YouTube videos on the subject (since there are YT videos about everything ...), and there is of course always Google.

                             

                            If you are more the 1-one-1 type, maybe you're interested in a tutorial. If so, let me know.

                            1 of 1 people found this helpful