Solved

Formula fields addition

Posted on 2004-09-05
7
449 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 100

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 100

Accepted Solution

by:
mlmcc earned 500 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 100

Expert Comment

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

mlmcc
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
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…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
Need to grow your business through quality cloud solutions? With everything required to build a cloud platform and solution, you may feel like the distance between you and the cloud is quite long. Help is here. Spend some time learning about the Con…

914 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now