Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

transfer sum() to field

Status
Not open for further replies.

tripod

Programmer
Nov 19, 1999
1
0
0
US
I have a database(Foxpro Win2.6) which has patient charges and pmts in &quot;fee&quot; field. Their account numbers are in field &quot;acc_num&quot;. Some patients have only a few entrys,and others have several. I have a field named &quot;balance&quot;,which I have been trying to place the sum() of each &quot;fee&quot; for each patient,but can't seem to get it right. Will appreciate any help I can get. Thank you in advance !<br>
-tripod<br>

 
hi...<br>
I am not sure if I got your question correct or not...Here is my solution according to what I understood:<br>
First you have to filter the data of each account number (of each patient) through either set filter to in the same table , or through Select SQL into a temporary table after assigning a select area for it (this is faster than set filter to). Now you will have all the data from all the fields for this particular patient. Then use calculate sum((charges field number 1)+(charges field number 2+...etc)) to a memory variable (e.g. sum_fees). If you plan to have the total charges for each patient regardless of the dates of his visits, then create a separte table that refers to this particular patient either through his file number or account_number with a field named e.g. Total_fees. Now after getting the sum_fees from first table, open the second table through another select area and replace the field Total_fees with the memory variable sum_fees. Of course the memory variable has to be Public variable. If you want to calculate charges for the patient of his current visit, then you have to filter the data according to the date of each visit.<br>
I hope this answers the question.<br>
Dr. Qasem Alsaleh
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top