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

Help with Variables 1

Status
Not open for further replies.

dgillz

Instructor
Mar 2, 2001
10,043
US
I have a problem and I believe variables are the solution but I have no experience in this area. I have an A/R Aging report, and I need to take the Sum of a group based on ApplyTo number and then age it buy using the Aged0to30days, Aged31to60days, Aged61to90days and Over90days funtions.

If I had exactly one value in my databse per apply to this would be very easy. However, I could have several values for a gicen applyTo number, for instance an Invoice for $1000, a Payment of $900 and a credit Memo of $75 leaving a balance of $25.

The issue I have run up against is that I need to age the sum of these 3 numbers by the OLDEST of the transactions. I can do a minimum summary function on the document date, and age it with aged functions, but then I cannot get a customer total or Grand total aging, only an Apply to Aging.

HOw the heck do I do this? Software Support for Sage Mas90, Macola, Crystal Reports and Goldmine
 
You will need a running total to add up fields that are based on summaries. Use the 3-Formula technique described in faq149-182. Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Guide to using Crystal in VB
tek@kenhamady.com
 
Ken,

I tried a variation of your approach as follows:

Group Header
@ResetCustCurrent
WhilePrintingRecords;
NumberVar CustCurrent:=0

Details
None -- I am not accumulating details, just the summary

Group Footer
@CustCurrent
Global NumberVar CustCurrent;

WhilePrintingRecords;
if Minimum ({@docdate}, {AROPNFIL_SQL.Apply_To_No}) in Aged0To30Days then
CustCurrent:=CustCurrent+Sum ({@totamt}, {AROPNFIL_SQL.Apply_To_No})

else CustCurrent:=CustCurrent;

Numbervar CustCurrent

The results I am getting is the LAST occurence of a value in my {AROPNFIL_SQL.Apply_To_No} rather than a sum of those by Customer.

Any ideas? Software Support for Sage Mas90, Macola, Crystal Reports and Goldmine
 
Ken,

After playing with this for a while (2 hours) I got it to work. Thats the good news. The bad news is that I am having trouble grasping the concept of "while printing records". I am sure if I were to be given a similar project in the future, I could figure it out, but I do not totally understasnd how this works.

Software Support for Sage Mas90, Macola, Crystal Reports and Goldmine
 
You should read Appendix A in your Crystal Users manual for an explanation of the report processing steps.

Here is a short answer. WhilePRintingREcords means that this formula is calculated after the report is Grouped, Sorted and the totals are complete. Yours has to be since you are referring to totals in the formula. If you were creating a formula to be used in a summary operation, you would need to do that formula WhileReadingRecords, and you couldn't refer to any totals inside it. Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Guide to using Crystal in VB
tek@kenhamady.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top