benlevi

Histogram function?

Discussion created by benlevi on Oct 20, 2012
Latest reply on Oct 20, 2012 by mdiehr

My client has a series of surveys, each with a number of questions, each response being a number on a Likert scale (1-5, or 1-9, etc.)

 

I've been tasked with giving them a 'histogram' of each question, where for a found set, it would tell how many chose 1, 2, 3, etc.

 

I can do it with each question being on a separate layout by sub-summary based on the response and using a Summary field to Count the responses. This effectively produces a report like this:

1 10

2 3

3 1

4 9

5 5

 

Where 10,3,1,9,5 are the # of respondents who chose 1,2,3,4,5 respectively. I can then produce a bar graph which is effectively a histogram.

 

The problem is that each question needs its own layout because it needs to sort the found set by that question. My client would like to see all the results for a particular survey on a single layout.

 

Is there a way to create a custom function that has as its input a field, and a 'Likert number' like 5 (or I can create a HistogramQ1 Repeating Field of 5 to put the answers into), and the function would go through the found set, count the # of repondents who chose 1, 2, etc. and place that count into the HistogramQ1 repeating field, so with the above example, the results would be:

HistogramQ1 = (10,3,1,9,5)

 

I tried looking in Brian Dunning's CF page, but didn't find anything (note I didn't go through the whole list in detail though).

 

Thanks!

Outcomes