AnsweredAssumed Answered

How can I display a count of records matching criteria?

Question asked by mbl1230 on May 4, 2018
Latest reply on May 4, 2018 by mbl1230

I am a novice user of Filemaker so this question may not make much sense. For that, I apologize. I have a single table database. My question pertains to the best way to compute and display the number of records satisfying different constraints.

 

As a trivial example let each record consist of a two fields of numbers. I would like to know the number of records for which each of these conditions exist:

  1. Both the first and second fields are less than -100
  2. The first field is greater than 1 AND the second field is less than 7 OR the first field is <0
  3. The first field is greater than 5

 

My approach to displaying the desired data was to write a script that first performed a find using each criterion followed by setting a global variable whose value was set to Get(FoundCount). I then defined 3 calculation fields which were set to each of the global variables and display them in another layout that has only those 3 fields.

 

This approach only sort of works. I can make a change to the data (including adding a new record) and then run the script, but the global variables don’t seem to update. However, if after making a change to the data and running the script I then add a new empty record, the variables update to the correct values and display properly in their layout.

 

  My specific questions are as follows: 1) Is there a better way to do what I want?, 2) Why do I need to add an empty record after running the script to get the variables to update?, and 3) is there a way of getting the script to run automatically whenever there is a change to the data?

Outcomes