Hi again everyone,
I'm trying to achieve a way to find the total spend for everyone that's bought things over a month.
using the Sum(Am1) expression works by giving me the entire column, however that appears as a grand total for the entire month.
What I'm after is a total of say "Mr. Smith" and another total for "Mrs Smith".
Am1 holds the amount spent
Name holds the name
Accno holds the account number.
Cardno holds the account number too in a different table.
Balance will be the field that will hold the total value of amount spent per user.
So basically when the name or account number changes, that's when VFP should totalise the figures for that user.
Code below so far (I've re-written it five different times!):
I was hoping to try and crack it but clearly not yet lol...
Eventually this will be integrated into a form with buttons for a end user to scroll through - but that's another chapter!
Thanks guys.
A conclusion is simply a place where you got tired of thinking.
I'm trying to achieve a way to find the total spend for everyone that's bought things over a month.
using the Sum(Am1) expression works by giving me the entire column, however that appears as a grand total for the entire month.
What I'm after is a total of say "Mr. Smith" and another total for "Mrs Smith".
Am1 holds the amount spent
Name holds the name
Accno holds the account number.
Cardno holds the account number too in a different table.
Balance will be the field that will hold the total value of amount spent per user.
So basically when the name or account number changes, that's when VFP should totalise the figures for that user.
Code below so far (I've re-written it five different times!):
Code:
CLOSE TABLES ALL
USE id IN 4
USE till IN 1
USE temptable IN 2
SELECT 1
SET FILTER TO dat =>{^2015/11/02} AND dat <={^2015/11/16}
SORT TO november ON accno /A
USE november IN 3
DO WHILE !EOF() = .T.
CALCULATE SUM(Am1) WHILE till.accno = id.cardno
INSERT INTO temptable (balance) VALUES (Am1)
LOOP
SKIP
ENDDO
I was hoping to try and crack it but clearly not yet lol...
Eventually this will be integrated into a form with buttons for a end user to scroll through - but that's another chapter!
Thanks guys.
A conclusion is simply a place where you got tired of thinking.