Heres a demo file of one possible approach: http://www.4shared.com/file/WhIXK_hZ/HistogramDemo.html
HistogramDemo is a table limited only to fields that serve as relational keys to link to specific records in scores. You can delete all records in this table without affecting any real data. You enter the minimum and maximum scores, an exam ID and specify the desired interval. You then create records in this table until the last record created is greater than or equal to the maximum score. Then switch to the last layout to see a chart of the resulting historgram. The scores table lists sample data of possible scores.
To see the chart, you must have FileMaker 11.
I downloaded the demo. I looks good but my question is, how do you add records to the HistogramDemo table for each new exam? manually or thru a script?
Please disregard the last post. I looked further into the table and field definitions and realized you are using a global field. It works beautifully. But I'm having a hard time wrapping my head around how it works. The cCount calculation works almost like a countif() function which I have not been able to easily duplicate on FM. Can you explain the mechanics behind it?
All aggregate functions such as count(), Sum(), average() etc. when used to reference a field in a related table, compute the specified aggregate value of all related records. So Count returns the number of related records were the specified field is not empty.
The inequalities in the defined relationship, will match a given histogram record to exam scores in a given range of values--that gives you the "if" part of the process here.
This demo is a very stripped down proof of concept. You may need to modify it to better suit your purposes. You could, for example, make ExamID a local field and use replace field contents to put the same ID value in all the records of the current found set. This would enable you to create sets of histogram records that each pull data for a given exam from scores. That way a simple find to find all histogram records with a given exam ID can be used to pull up a histogram chart for each exam once you've created the necessary histogram records for it.
I've already incorporated into my Db and I'm very happy with the result. I put the graph on a tab on a layout based on the exams table. I created a script to update the gSelectedExam field to match the current exam on record load. I will have to show it to the course director and make a few more tweaks, but otherwise it's perfect. BTW. Do you share these as freeware or shareware?
On the "if" part. Do you mean that if the relationship had been set with an equal sign and a single field on each table, the count function would return 1 but setting up the <= an >= ranges in the relationship makes each record on the histo table look at several records in the scores table and therefore the count function returns a true count?
If you used an = operator instead of two field pairs with < and >, you'd match only scores with exactly that value rather than a range of scores falling in that record's interval so count would then have a much smaller number of related records to count.
Any link I post to a File I have uploaded to a share site is Freeware.
Heres a link to a database file of known Filemaker Pro and GO bugs that has become my most popular download:
And yes, it's also "freeware" ;-).
That's very generous of you. Thanks again!