Can somebody advise whether there’s a good built-in way (= AppleScript command) to pull out statistics for a DB:
I need to count the number of occurrences of a string in a particular field over all records.
E.g. for a record that has
- Name
- Phone
- Town
the script would return how many records exist with identical towns.
Step 1 – Create a relationship.
– File > Manage Database > Define Database
– Relationships tab
– Duplicate your table occurance and name it (I used
related_towns)– Drag a relationship between the two from town to town
– Click OK.
Step 2 – Create a calculated field that counts the instances of the related (duplicative) town name.
number_of_related_towns) at the bottom of the screenBe sure that “Evaluate this calculation in the context of” is set to the name of your base table (what your layout is based on). Replace
related_townswith whatever you named your new table occurance.Step 3 – Write a script to display your data.
Let me know if you have any questions.