This topic is locked

Sum field based on other fields

2/8/2008 11:24:32 PM
ASPRunnerPro General questions
K
kwilsokl author

Hi
I am using ASP runner 5.1
I am looking to have a field(text) have a sum value of three other number fields. so a user will enter data(numeric values) in 3 fields and the forth fields value will be a sum of the other 3
Ok so here is my code
I want Incoming_calls, to be the total of Call_transactions_12AM_to_7:59_AM, Call_transactions_8AM_to_4:59_PM and Call_transactions_5PM_to_11:59_PM
when a new record is added
SELECT Monthly_Data_report.Incoming_calls, Monthly_Data_report.[Call_transactions_12AM_to_7:59_AM], Monthly_Data_report.[Call_transactions_8AM_to_4:59_PM], Monthly_Data_report.[Call_transactions_5PM_to_11:59_PM], Monthly_Data_report.Average_length_Of_call, Monthly_Data_report.Call_Abandonment_Rate, Monthly_Data_report.Active_agencies, Monthly_Data_report.Active_services, Monthly_Data_report.Notes, Monthly_Data_report.MDRID, Monthly_Data_report.OID, Monthly_Data_report.Month_Year, Monthly_Data_report.[Call Center], Monthly_Data_report.Counties, Monthly_Data_report.CompletedBY, Monthly_Data_report.PhoneNumber, Monthly_Data_report.Call_Center_ID

FROM Monthly_Data_report;

Sergey Kornilov admin 2/12/2008

I guess you can use BeforeAdd event and the following code:

dict("Incoming_calls") = dict("Call_transactions_12AM_to_7:59_AM") + dict("Call_transactions_8AM_to_4:59_PM") + dict("Call_transactions_5PM_to_11:59_PM")
K
kwilsokl author 2/12/2008

Hi Sergey
Thanks for the response and the example code that helped, but instead of getting the sum of the 3 fields it just display the entered numbers of all 3
for example if I enter the value of 44, 44,44 in each field I get the result of 444444 in Incoming calls field
BY the way you are a genius you know; this program is great and I hope if it hasn't already it makes you very rich
MDRID 1

Month & Year 2/12/2008

Incoming Calls 444444

Call Transactions 12AM to 7:59 AM 44

Call Transactions 8AM to 4:59 PM 44

Call Transactions 5PM to 11:59 PM 44

Average length Of call

Call Abandonment Rate

Active Agencies

Active Services

Notes

Call Center

Counties

CompletedBY

PhoneNumber

J
Jane 2/13/2008

Hi,
try to use this code:

dict("Incoming_calls") = CInt(dict("Call_transactions_12AM_to_7:59_AM"))+CInt(dict("Call_transactions_8AM_to_4:59_PM"))+CInt(dict("Call_transactions_5PM_to_11:59_PM"))

K
kwilsokl author 2/26/2008

Hi,

try to use this code:


Thank you both so much, that worked perfectly