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

Variables in Crystal 1

Status
Not open for further replies.

kimchavis

Technical User
Jan 7, 2004
66
US
I was hoping that someone could help me with this Crystal problem that Im
having:

I want to sum loan amounts at the group level. I have a group
selection criteria in the report which is still showing in the sum.
I have tried using a variable:

whileprintingrecords;
global numbervar sumloan; placed in report footer (this is what is
not totaling correctly) It returns the last loan amount.

whileprintingrecords;
global numbervar sumloan:= 0; placed in group header

whileprintingrecords;
global numbervar sumloan:= sumloan + {LOAN.LOAN_AMOUNT} placed in
group footer. This is returning the loan amt that I want totaled
for the first variable.

I believe that this is going to have to be accomplished by
using variables. There is several instances of the loan amount under
the group. Therefore each loan amt is being summed multiple times in
the total. This is why I only want the loan amt for the group, no
matter how many times it appears in the details section. Normally
this could be solved by using a running total, however, when you use
group selection expert, It doesnt really get rid of the data, its
still there to be included in the sum. I tried putting the formula
(that I use in the group select expert) in the running total, But it
still doesnt work because I want it based on the group, and you can
only do the group or the formula not both.


Can someone please tell me what Im doing wrong?
 
"whileprintingrecords;
global numbervar sumloan:= sumloan + {LOAN.LOAN_AMOUNT} placed in group footer. This is returning the loan amt that I want totaled for the first variable."


Try putting the above code in the detail level.
 
For what you are trying to do, there is no need to use a variable. Just place the field {LOAN.LOAN_AMOUNT} in the details section, right click on it, and select insert summary.

Software Sales, Training, Implementation and Support for Exact Macola, eSynergy, and Crystal Reports
 
There is several instances of the same record in the details section. EX:

GROUP Loan # 12345 Smith Joe loan amt 100,000
DETAILS 12345 acct suspended doc in loan amt 100,000
12345 acct reinstated doc completed loan amt 100,000


I have a formula that sums and tells me if a certain action in the details arises give me 1 else 0. To exclude the entire record that the sum is greater than 1, I have to place the exclusion in the Group Selection box of the Select Expert. Im trying to sum the loan amts for what is left. The group selection box doesnt really get rid of the record, it acts as if it supresses it. Hopefully this further explains my problem..



 
In response to:
"whileprintingrecords;
global numbervar sumloan:= sumloan + {LOAN.LOAN_AMOUNT} placed in group footer. This is returning the loan amt that I want totaled for the first variable."


Try putting the above code in the detail level.

I tried this, It is doing a running total on all records in the details section including those I excluded in the group selection. I only want the loan amt for the group to be included in the running total (as all loan amts under the group will be the same as the group header, same record different views) and not to include those groups that were excluded from the group selection. Does this make sense?


 
If it is in the Group footer...you are getting the loan amt for the LAST record of that group...if that is what you want then that is fine.

whileprintingrecords;
global numbervar sumloan:= 0; placed in group header


THIS SHOULD NOT BE PUT IN THE GROUP HEADER...you are resetting your total every new group.

Place this in the report header instead...that is your problem


Jim Broadbent

The quality of the answer is directly proportional to the quality of the problem statement!
 
Ngolem- THAT WORKED!!!!! YOU ROCK!!!!!!!!!!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top