Print Page | Close Window

Crystal Report - Writing Code In Loop

Printed From: Crystal Reports Book
Category: Crystal Reports for Visual Studio 2005 and Newer
Forum Name: Writing Code
Forum Discription: .NET programming API, report integration
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=11857
Printed Date: 28 Apr 2024 at 9:43am


Topic: Crystal Report - Writing Code In Loop
Posted By: Victoryy
Subject: Crystal Report - Writing Code In Loop
Date Posted: 13 Dec 2010 at 7:02pm
Hi,
I have a account ledger report. the report is grouped by account number..
For each account number i have derived the opening balance...
Again under the group of the account number there are detail entries of DR and CR amounts..
Now i have to derive the Closing balance along with opening balance with recursively adding DR and subtracting CR..
If Opening Balance is 100
DR    CR
10    20
20    10

Closing Balance Will Be
100+10-20 = 90
90+20-10 = 100

How can i do this in Crystal reports....
can i use the formula field, but how can i write a block of code in formula field. Cry

Thanks In Advance...



Replies:
Posted By: Isak
Date Posted: 17 Dec 2010 at 12:37pm
Simple, if I'm understanding you right:

formula ={@OpeningBalance} + Sum({dr}, {accountNumber}) - Sum({cr}, {accountNumber})


The sum function will give you the sum of that field (first argument) for the group (second argument).


Posted By: Victoryy
Date Posted: 21 Dec 2010 at 2:23am
Thanks A Lot!!!!!!!!!!
It Helped Me!!!!!!!!!!!!ClapSmileClap



Print Page | Close Window