5 Replies Latest reply on Apr 10, 2017 2:27 PM by fitch

    History Portal


      I am trying to make a history portal for my check out system, I have the necessary table and relationship needed but it won't work.

      Screen Shot 2017-04-10 at 1.49.01 PM.png

      Screen Shot 2017-04-10 at 1.48.36 PM.png

      Screen Shot 2017-04-10 at 1.45.29 PM.png

        • 1. Re: History Portal

          Either you have linked the wrong fields as match fields or you have named one of them incorrectly.


          a "kp" field would be a field that auto-enters an ID that uniquely identifies the record in that table. You would not link the kp field of one table to the kp field of another. But on taking a closer look at your relationship graph, it looks like you have incorrectly named this field in the History table.


          But you haven't explained what you mean by "it won't work" so that leaves us guessing:


          As written, your script creates a new record in the History table, but does not set values to any of the fields in that new record. Not only is the record thus blank, but it is not linked to any given student record in the students table.


          I recommend that you research "MagicKey" as a way to create and link records in this history table.

          • 2. Re: History Portal

            Hey Tremor,


            So your goal is to have a table of history records that are created via script when an item is checked in?


            Assuming that's true, there are a couple of things you might wanna check. Without knowing more about about your situation I may just be misunderstanding though.


            So I see that your script saves a great deal of variable data, navigates to another layout and then creates the record. Have you gone to this table to see if it's actually creating the records? That would mean that it's just not being related properly, which is easy to fix. May I ask what you are saving all of the variables for? Are they supposed to be written into the history table?


            I assume that the records are being created, but not related. If that's the case, it is probably because you're not actually relating them in your script. You will need to actually set the appropriate foreign key field to the value you want.


            When you create records via a relationship in FileMaker it will go ahead and automatically relate the records. But this doesn't work in scripting. You'll need to walk through all of the steps you would go through to manually validate the relationship i.e. trade keys.

            • 3. Re: History Portal

              Here are some additional resources that may help. They make the foundation of relational databases.


              If you have Lynda.com: Using primary and foreign key fields


              FileMaker Training Series: Relationships Session | FileMaker - an Apple subsidiary


              I only recommend this because it looks like you may not be using the keys as intended. Just conjecture though without more info.

              • 4. Re: History Portal

                script only creates a record, you should set appropriate fields with variables defined.

                • 5. Re: History Portal

                  We're trying to guess what you mean by "won't work."


                  1. It looks possible that your script isn't populating the History fields because typically we see some Set Field steps after the New Record step. But it's also possible that your fields are auto-entering the variable values and so maybe your History records are getting created as expected. Please clarify.


                  2. It looks like you want to see the History for a given piece of equipment in the portal in the popover. But the relationship looks like it's only going to show the history of one student, if there's one currently assigned. If there's currently no student assigned to the equipment, you'd have no relationship to History.


                  Perhaps you could rename History to 'Student History' and make another Table Occurrence (TO) of History called 'Equipment History' that links directly to Equipment by equipment ID.


                  Or you might want to learn about many-to-many relationships. Perhaps History should really be the join table between Students and Equipment.