Forums
This topic is locked
calculating columns
Posted 22 Apr 2003 01:09:47
1
has voted
22 Apr 2003 01:09:47 Alfa Siete posted:
we make inspections every week in three drugsotres, we check many things and we assign a number: 4 if the results are poor, 7 if acceptable, 10 if excelent.at the end of the month we have four numbers for each topic, (EG. beer fridge: week 1: 7, week 2: 10, week 3: 10, week 4: 10) what i need to do is to add the four columns to get an total and then divide between 4 to get the average of the month.
how do i add the four columns and then divide between 4.
tha values are in the same acces database, in differnet columns
Everybody should belive in something... I belive i'm having another beer
Edited by - sieteyuna on 22 Apr 2003 16:42:32
Replies
Replied 23 Apr 2003 01:27:07
23 Apr 2003 01:27:07 Alfa Siete replied:
solved, used local variable:
<% averrev = 1 %>
then in repeated region
<% averrev = averrev *(((Recordset1.Fields.Item("1RA"
.Value) + (Recordset1.Fields.Item("2DA"
.Value) + (Recordset1.Fields.Item("3RA"
.Value) + (Recordset1.Fields.Item("4TA"
.Value))/4) %>
then posted in the total column my local variable:
<%=averrev%>
Everybody should belive in something... I belive i'm having another beer
<% averrev = 1 %>
then in repeated region
<% averrev = averrev *(((Recordset1.Fields.Item("1RA"




then posted in the total column my local variable:
<%=averrev%>
Everybody should belive in something... I belive i'm having another beer
Replied 23 Apr 2003 09:12:41
23 Apr 2003 09:12:41 Vince Baker replied:
Another way of doing this would have been in the sql. This tends to be neater and easier to edit in future.
Example:
Select (1ra + 2ra + 3ra + 4ra) as Averrec
From yourtable
Regards
Vince
Visit my home: www.chez-vince.com
VBScript | ASP | HTML | SQL | Oracle | Hosting
Example:
Select (1ra + 2ra + 3ra + 4ra) as Averrec
From yourtable
Regards
Vince
Visit my home: www.chez-vince.com
VBScript | ASP | HTML | SQL | Oracle | Hosting