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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Balance & then sum of all after a certain date

Status
Not open for further replies.

SSSFisgard

Technical User
Nov 7, 2006
27
Hi guys,

I need a little help if possible. I'm working on CR Server R2, on a sql database.

Heres my problem. I need to capture a mortgage balance at a certain date, (actually a date that has a specific code associated) and then sum all transactions after that date.

I need to be able to dispay not only the balance, but also the sum of the transactions after.

So it should look like:

Balance @ June 30 07 = $?????????
Sum of transactions after = ????????


i hope i've explained myself ok.
 
You could use a formula something like this:

whileprintingrecords;
datevar datex;
numbervar sumx;

if {table.code} = "X" then
{table.date} := datex;
if {table.date} >= datex then
sumx := sumx + {table.amt};

If you want the summary at the group level, then you'd need a reset formula in the group header:

whileprintingrecords;
datevar datex;
numbervar sumx;
if not inrepeatedgroupheader then (
datex := date(8999,9,9);
sumx := 0
);

You would display your results in the group footer with a formula like this:

whileprintingrecords;
numbervar sumx;

If this doesn't do the trick, you should provide sample data and explain what didn't work.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top