3 Replies Latest reply on Aug 3, 2017 3:35 PM by philmodjunk

    How to increment the Qty view field in a non related table

    diegoadum

      Hi there!

       

           I'm building a form which has some related tables, but I need to keep some statistics regarding how many times a record was requested/Viewed. My approach was to create a new table "Statistics" on which I have a field which will store this value. When I create a script to make the update, I got a message stating that the record can't be updated due to the table is not related to other tables.

       

      Any suggestion will be super appreciated!

        • 1. Re: How to increment the Qty view field in a non related table
          philmodjunk

          Why not relate it? There are ways to switch to a layout, make the change and switch back, sometimes using an additional window in the process, but don't see any reason not to make it one more related table here.

          • 2. Re: How to increment the Qty view field in a non related table
            diegoadum

            Maybe I'm wrong here, but the way I see it, is the Statistic table have no relation to the rest of the tables or even records. In fact, so far it has only one field, which is the one to count how many time a request was made.

             

            Again, maybe I'm losing something due to I have 0 experience in FileMaker.

            • 3. Re: How to increment the Qty view field in a non related table
              philmodjunk

              You can do this:

               

              Go to manage database. Select any field in your statistics table that permits use as a match field and drag to any such field in your layout's table. Double click the relationship line to get a dialog where you can change the = operator to the Cartesian join operator ( X ). This relationship now matches that one statistics record to all records in your layout's table and as long as you've created at least one record in that statistics table, you can now edit it directly from the context of your layout.

               

              The alternative is:

              Set a variable to the value you want

              Change to a layout based on the statistics table

              Use set field to reference your variable and update the field in the statistics table.

              Return to original layout.

               

              This can trip a host of script triggers. Some minimize that issue by first opening a hidden window before changing layouts and updating, but this still trips at least a few triggers--less in FileMaker 16 than older versions as the new window step can now specify a layout rather than opening to the same layout as the current window and then needing go to layout to change layouts as is the case in older versions.

               

              But using the Cartesian join seems a lot simpler to me....