Reputation: 6638
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
the script would return how many records exist with identical towns.
Upvotes: 1
Views: 426
Reputation: 2239
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_towns
with whatever you named your new table occurance.
Step 3 - Write a script to display your data.
Let me know if you have any questions.
Upvotes: 2
Reputation: 2239
I would do this in FileMaker. It is built for exactly this. Do you know how to do it in FM?
Upvotes: 0