Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Formula fields addition

Posted on 2004-09-05
7
Medium Priority
?
457 Views
Last Modified: 2008-02-20
I have the following issue in Crystal Reports 10:

we are doing a crystal report with the following format:
Account            Description      Beginning Bal      Current Balance      Ending Balance

The user chooses a period..let us say 200404.
The logic is as follows:
Beginning Balance contains the sum of all account amounts for whole of 2003 ie., 200301 to 200312 plus all account amounts till april 2004 ie., till 200403.

current Balance contains all account amounts for the current period ie., for 200404 ie., only for the month of april.

Ending Balance is sum of Beginning Balance and Ending Balance.

This should be for all account numbers.

the these account numbers are grouped by ranges as total expenses,total revenues,total income etc.

The problem is all the account amounts are stored in a field called BAMOUNT. This stores both positive and negative values ( for debit and credit values).

How do we get this right:

Format:

Account            Description             Beginning Bal      Current Balance      Ending Balance
11001            xxxxx            2500            3000            5500
12001            xxxxx            3400            3400            6800

Total Liability                  5900            6400            12300

like the above format we are having lot of groups.

we have done some logic which checks the input period and picks up amounts for each account number from the previous period and upto the current period, ignoring the sign and placing it right.

same way for current balance also.

but when we are trying to add beginning balance  to current balance to get the ending balance we are getting erroneous results.

all three of them are placed in group footer with detailed section supressed.

please give me a solution for this ASAP.

so how do i get the whole thing right.



expecting a detailed response.
0
Comment
Question by:aquariansp
  • 3
7 Comments
 
LVL 101

Expert Comment

by:mlmcc
ID: 11984045
What formulas are you using?

mlmcc
0
 

Author Comment

by:aquariansp
ID: 11984259
The formulae we are using are:

BegBal

if {T99_DETALJ.POST_PERIODE} = {?Period} then
0
else
abs({T99_DETALJ.BELOP});

Credit1

if {T99_DETALJ.POST_PERIODE}={?Period} then
    if {T99_DETALJ.BELOP}<0 then
        {T99_DETALJ.BELOP}
else
 0;

Cur_Period

abs(Sum ({@Credit1}, {T99_DETALJ.KONTONR}))+Sum ({@Debit1}, {T99_DETALJ.KONTONR})

CurPer

if {T99_DETALJ.POST_PERIODE} = {?Period} then
abs({T99_DETALJ.BELOP})
else
0;

Debit1

if {T99_DETALJ.POST_PERIODE}={?Period} then
    if {T99_DETALJ.BELOP}>0 then
        {T99_DETALJ.BELOP}
else
 0;
 
EndBal

Sum ({@Debit1}, {T99_DETALJ.KONTONR})+abs(Sum ({@Credit1}, {T99_DETALJ.KONTONR}))+Sum ({@BegBal}, {T99_DETALJ.KONTONR})







From

stringvar yea;
yea:=totext(tonumber(left({?period},4)),0000,'');
yea:=totext(tonumber(yea)-1,0000,'');
yea:=yea&'01';
yea;

LedgerId

if {T99_DETALJ.BILAGSART}='0' then
   'ACTUAL'

RecEndBal

whileprintingrecords;
abs({@Credit1})+ {@Debit1}+{@BegBal}

TitlePeriod

stringvar yea1;
stringvar mon1;


mon1:=right({?period},2);
yea1:=Mid ({?period},3 ,2 );
mon1&'-'&yea1;

to

{?Period}


RECORD Selection formula

{t99_detalj.post_periode}>= {@from} and {t99_detalj.post_periode}<={@to} and {T99_DETALJ.SELSKAPSKODE}={?CompanyId}

Hope this helps in telling us why we are not able to add up beginning balance and current period amounts to get proper ending balance values.

~aquariansp
0
 
LVL 101

Accepted Solution

by:
mlmcc earned 2000 total points
ID: 11985296
2 formulas need to be fixed

Credit1

if {T99_DETALJ.POST_PERIODE}={?Period} then
    if {T99_DETALJ.BELOP}<0 then
        {T99_DETALJ.BELOP}
    else
       0
else
  0

Debit1

if {T99_DETALJ.POST_PERIODE}={?Period} then
    if {T99_DETALJ.BELOP}>0 then
        {T99_DETALJ.BELOP}
    else
       0
else
  0


In this formula
From

stringvar yea;
yea:=totext(tonumber(left({?period},4)),0000,'');
yea:=totext(tonumber(yea)-1,0000,'');
yea:=yea&'01';
yea;

From

stringvar yea;
yea:=totext(tonumber(left({?period},4)),0000,'');
yea:=totext(tonumber(yea)-1,0000,'');  'What is this line doing?
yea:=yea&'01';
yea;


mlmcc
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 12196583
I suspect I may have solved this witht he formula correction
mlmcc (11985296)

mlmcc
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hot fix for .Net Crystal Reports 10.2.3600.0 to fix problems with sub reports running on 64 bit operating systems ISSUE: Reports which contain subreports fail with error "Missing Parameter Value" DEPLOYMENT SERVER OS: Windows 2008 with 64 bi…
Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…

927 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question