Get Average Score Value of Surveys

Hey All,

I have a form which I want to populate the Average score of a user’s total number of generated surveys.

I’m just not able to think on the programming aspect on how to get that done…

Example: John has 3 surveys, overal score of the 3 are, 1, 2, 1

From the View it would display 1.33 as the average score. I want to have this number programmed into a form.

I’ve tried @Sum(r) / @Elements(r), but that did not work.

Any thoughts?

thanks

Subject: Now I have a new issue…How do I omit certain values

Okay I’ve figured out how to get the average, but I’m running into an issue. Some documents either have a blank entry or an N/A on it. Of course this will cause problems adding the numbers up. How to I omit these documents if the field contains N/A or “”

I tried: @If(@IsError(r) | r = “” | r = “N/A”; r := 0; r);

But that just makes the whole thing as a value of 0. I tried this as well:

@If(@IsError(r) | r = “” | r = “N/A”; NULL; r);

But I got a @Error displayed in the field.

Any ideas?

Thanks

Subject: Found the Solution…

Okay I got it working.

I edited the view to make blank any entries that have a “N/A” in it.

On the field which does the computing I did a @Trim to the DBLookup, which omitted the blank entries

and that worked!

Subject: Found the Solution… (average for survey docs)

Okay I got it working.

I edited the view to make blank any entries that have a “N/A” in it.

On the field which does the computing I did a @Trim to the DBLookup, which omitted the blank entries

and that worked!

Could anyone please help by expanding upon this solution? I have a similar situation, but I’m trying to caluculate all fields contained in a document, but I too need to exclude fields with “N/A” - any additional help is appreciated

thanks -Tony

Subject: RE: Get Average Score Value of Surveys

It sounds like you have a separate document for each survey. You want to display the average on “a form,” and I’m assuming it’s not the same form as is used for the surveys. I’m not sure what this “r” is that you’re using in your formula. You seem to be assuming that it will contain a list of all John’s scores, and if it does, this formula should in fact calculate the average.

But why you think r will contain a list of a particular person’s scores? You would have to arrange for this to happen, for instance by using @DbLookup to pull in the list from a view, using John’s name as a key.

There are no spooky connections between documents that just happen to have the same data value in a certain field. Notes has no way to know which field is an identifier. You have to build your own connections.

Subject: RE: Get Average Score Value of Surveys

The r represents the DBLookup. It’s gathering the values from the column number for every document for a specific person. I have no problems adding the values of that column, but I’m trying to achieve the average of that value.

Example: (TSS = A chosen User Name)

r:=@TextToNumber(@DbLookup(“”; “PHXAPPNOTES03”:“Job_Proj\ETC\HelpDesk\surveys.nsf”; “(PSS Survey Results)”; TSS; 10 ));

@If(@IsError(r) | r = “” | r = “N/A”; r := 0; r);

value := @Sum(r) / @Elements(r);

@If(value = “0” & Surveys = “0”; “No Surveys Generated”; value2)