This topic is locked

Average of multiple fields

3/23/2009 11:53:19 AM
ASPRunnerPro General questions
S
sunnynayak author

I have created a training feedback form.

The table name is zero_FB.. I have multiple questions which are rated on a scale of 1 to 4

I have an average field which is not visible on the add form, however i want this field to display the average score of the feedback which will be an average of all the points selected on the add form.

S
sunnynayak author 3/23/2009

please help.. or let me know if more information is needed

Sergey Kornilov admin 3/23/2009

If you are talking about several fields you can use a simple calculated field in SQL query i.e.

select ...

(field1+field2+field3+field4)/4 as average

from ...


Then you can display average field on list/view pages.

S
sunnynayak author 3/23/2009

If you are talking about several fields you can use a simple calculated field in SQL query i.e.


select ...

(field1+field2+field3+field4)/4 as average

from ...


Then you can display average field on list/view pages.


thankyou for your reply admin
please help me understand this further..

The field on the db where i want average calculated is "average" and the table name is zero_FB
my current query without any calculations is

SELECT

Location,

[Trainer Name],

[Batch ID/Number],

[Training Start Date],

[Training End Date],

[Training Name/Type],

Process,

[course materials relevance],

[material helpful],

[training period],

[focus on culture language],

[practice exercises],

[resources and tools],

[customer service techniques],

Comments

FROM [30_FB]
so will the new query look like
SELECT

Location,

[Trainer Name],

[Batch ID/Number],

[Training Start Date],

[Training End Date],

[Training Name/Type],

Process,

[course materials relevance],

[material helpful],

[training period],

[focus on culture language],

[practice exercises],

[resources and tools],

[customer service techniques],

Comments

FROM [zero_FB]

select average

(field1+field2+field3+field4)/4

from zero_FB

Sergey Kornilov admin 3/23/2009

You don't need a field named average. It will be calculated on the fly:

SELECT

Location,

[Trainer Name],

[Batch ID/Number],

[Training Start Date],

[Training End Date],

[Training Name/Type],

Process,

[course materials relevance],

[material helpful],

[training period],

[focus on culture language],

[practice exercises],

[resources and tools],

[customer service techniques],

Comments,

(field1+field2+field3+field4)/4 as average

from zero_FB
S
sunnynayak author 3/24/2009

worked great.. thanks for the help sergey