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

Totals first then selected detail 1

Status
Not open for further replies.

kbjarns

Programmer
Mar 30, 2011
4
Hi All,

Trying to create a quarterly report where the first line printed would be the beginning balance. The beginning balance is a sum of all transactions with dates that fall before the start date. Printed next would be all transaction records that fall within the quarter. The quarter is determined by user entered start date and end date parameters.
Problems I am running into are defining a variable that will reset with the next client, I have a formula that will display the first account total correctly but then continues to grow, I have had no luck getting it to reset.
Next issue is suppressing those records that don't fall in the date range. Tried using the "Suppress" printing option but here again no luck.

dates are formatted as mm/dd/yy

using Crystal 2008

I am new at CR and so any suggestions would be appreciated.

Thank you

 
Define the overall date range using your parameters ({?Start} and {?End} in the record selection formula like this:

{table.date} >= {?Start} and
{table.date} < {?End}+1

Then create a formula like this:

//{@QtrGroup}:
if datepart("q",{table.date}) = datepart("q",{?End}) and
year({table.date}) = year({?End}) then
"Qtr "+totext(datepart("q",{?End}),0,"") else
"Beginning Balance"

After inserting a group#1 on {table.client}, insert a group on the above formula. Then go into the section expert->details->suppress->x+2 and enter:

{@QtrGroup} startswith "Beginning"

This assumes that your date field is a date datatype, not a string. If it is a string, you need to convert it to a date in a formula like this:

//{@date}:
date({table.string})

Then substitute {@date} for {table.date} in the previous formulas. Right click on your fields and insert summaries as required and then drag the results into the group header #2.

-LB
 
Thank you lbass for the coding tips.

With your suggestions and few tweaks the report is now doing exactly what it needs to do except print a total amount at a group header level. (I can get the correct total at the group footer level). Some posts say that totals at the header level cannot be done, others give examples but nothing that I have been able to get to work.

Just to recap, the report reads transaction data sorted by clientid and transdate(ascending). Transactions that do not fall within the selected date range are totaled and not printed. This total becomes the "Beginning Balance" and can be printed in a group header section or at the start of the detail section. Transactions that do fall with in the date range are then printed showing the activity for the given time frame. Basically its a bank statement. I welcome any ideas you, or any one may have.

Once again thank you for help

Ken

 
It sounds like you are using running totals--and I see no reason for using them. Instead, you should be simply right clicking on fields in the detail section and inserting summaries on them and then dragging them into the group header.

-LB
 
LB

I join in the chorus with others in saying Thank You for the help. Your insights and suggestions have helped immensely.

Ken
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top