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!

Combining Result of Previous and Current Report 1

Status
Not open for further replies.

HulaGirl

Programmer
Apr 6, 2002
20
US
I have an accounting report, Report1. For example, In March, user generates Report1 to display some summaries of calculation. Next month, April, when user run Report1 again, she wants the summary info generated in the March to be on the April run side by side, so that they can compare. They also want to do some calculations using both last month and current month summary info. The users do not want two seperate reports. The summary info are not saved database fields, how should I approach this? THANKS!
 
Two options come to mind:

1) Bring in two months worth of data and perform separate summaries. You can use two running totals with:

// Current months data
month(currentdate) = month({YourTable.YourDateField})

or

//Previous months data
month(dateserial(year(currentdate),month(currentdate)-1,1)) = month({YourTable.YourDateField})

* Dateserial resolves having to worry about January to December

2) Create 2 subreports and place them alongside each other.

The latter is slower and less appetizing, though the former may not work depending on your report requirements.

-k kai@informeddatadecisions.com
 
Thanks K,

But the user requested the specific snap shot of last month's summary as Report1 was generated. User do not want to reflect any changes made between last month and the current month in the last month's Report1 for accounting purposes. Therefore creating both last month and current month's summaies at the same time does not meet the user's need. Can you provide other idea, please? Thanks
[sad][sad]
 
You will have to find some way to save the current data or at least the summaries so that it will be (1)unchanged and (2)available. CR will not do that for you alone. You can save a copy of the .rpt file "with data," or export to a text, rtf, or pdf file - that would let you reprint the report but I don't know any way you could bring that data into the next month's run. You could make a backup of the relevant tables containing the current data in your database, and pull that into your next report. You could create an update query that would store the current summaries in a new table in your database. You could export the summary data to an Excel spreadsheet and reimport the spreadsheet data into a subreport. That's all the options I can think of. You will have to go beyond just Crystal Reports for your solution.
 
The only other solution I can think is is to write a User Function Library. In fact, a combination of some of the UFL's I've got for sale will do this for you.

Use the DiskOutput Function Library to save your data into a disk file. Use the TextLookup Library to retrieve the data from the file. Editor and Publisher of Crystal Clear
 
The only solution I can think of is to create a report which saves the months data to a datasource, then next month, you can generate a report which uses that datasource alongside your current datasource in 2 subreports, or linked if applicable.

This would be better served by creating a table on the database which has monthly summaries by using SQL and scheduled jobs.

-k kai@informeddatadecisions.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top