Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Crystal Syntax help needed Post Reply Post New Topic
Author Message
Ian Gelderblom
Newbie
Newbie


Joined: 10 Jan 2011
Online Status: Offline
Posts: 11
Quote Ian Gelderblom Replybullet Topic: Crystal Syntax help needed
    Posted: 11 Jan 2011 at 12:08am
Hey Guys, I'm all new new to Crystal Reports.  I need some help on a Sum Amount that I want to return.  This is how it needs to work:
 
Tabel LedgerTransactions
 
LedgerTransactions.DDate     LedgerTransactions.Amount 
11/01/2009                                            1000.00  <--Calculate
12/02/2009                                            1000.00  <--Calculate
12/02/2010                                            1000.00  <--Calculate
12/02/2010                                            1000.00  <--Calculate = TotAmount
12/02/2011                                            1000.00
12/02/2011                                            1000.00
 
This is based on transactions for Company A.  I want to calculate the sum of all transaction for a certain date eg. Only for 2009. In principle the Total will be 4000.00 I've already got the Date which is {@Last_Month}.  The place where I'm stuck is where it neads to step through each record.
 
Explenation:
 
// Get record
// If LedgerTransactions.DDate <  {@Last_Month} then
   Add to totalAmount then NExt record
// Else next record
//Exit Loop, Return TotalAmount

 

 

 
 
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 11 Jan 2011 at 4:29am
You can just use a running total to do this
Name=wahtever
field to summarize=LT.Amount
type=Sum
Evalaute=use a formula
LedgerTransactions.DDate <  {@Last_Month}
Reset=Never (if you don't have any grouping that you need to reset on.)
IP IP Logged
Ian Gelderblom
Newbie
Newbie


Joined: 10 Jan 2011
Online Status: Offline
Posts: 11
Quote Ian Gelderblom Replybullet Posted: 11 Jan 2011 at 5:47am
 
Thanks, Im getting the correct TotalAmount when it is in my Details Section but then it shows it above every record.  I only need it to show once at the top. 
 
I've dragged it to my GH1 but then it returns only the 1st value in my Amount table and not the TotalAmount.
 
Possible Solution 2: Formula
 
I've struggle with this formula saying that it excecutes more than it should, infinite loop.. Do you maybe no where my fault is?
 
Dim Balance As Number
Do
    If {LedgerTransactions.DDate} < {@Last_Month} Then
           Balance = Balance + {LedgerTransactions.Amount}
           NextValue ({LedgerTransactions.DDate})
    Else
        NextValue ({LedgerTransactions.DDate})
    End if
Loop Until OnLastRecord = True
Formula = Balance
 
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 11 Jan 2011 at 5:59am

RTs do not work in headers, only in details or footers. They only summarize data that exists at the point the RT does in the report so it never includes rows below it.

Only group level Summaries can be in headers.
If you do not have duplicate data rows and this has to be in a header you can create a formula field to define the data then sum that ...
If LedgerTransactions.DDate <  {@Last_Month} then {LedgerTransactions.Amount} else 0
 
SUM(@formulafield,groupname)
 
  
 


Edited by DBlank - 11 Jan 2011 at 6:45am
IP IP Logged
Ian Gelderblom
Newbie
Newbie


Joined: 10 Jan 2011
Online Status: Offline
Posts: 11
Quote Ian Gelderblom Replybullet Posted: 11 Jan 2011 at 6:41am
Thanks, much apreciated!!   Clap
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.015 seconds.