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!

Crystal Subreport not recalculating

Status
Not open for further replies.

Kavius

Programmer
Apr 11, 2002
322
CA
I have a report that produces summaries for invoices (broken down by division/area/sales group/...). Fairly straight forward. My problem arises because next to the totals, there is supposed to be a second set of totals that calculate the total from the start of the period.

For example, if they select all invoices between 16-feb-2003 and 17-jun-2003, the main report will summarize the data between those dates and the sub report will give the same summary but for the dates 1-feb-2003 to 17-jun-2003.

This should happen for each division. There are two divisions (in my sample data). The first division is calculating correctly, the second division is displaying the same data as the first.

Is there a way to force the subreport to recalculate for each division?

_______________________________________
Ignorance is a beautiful thing:
You don't know what you can't do...
 
I'm not convinced that you need a subreport, which slows things down.

Create a start date formula akin to:

// I'll call it @StartDate
cdatetime(year(minimum({?daterangeparm})),month(minimum({?daterangeparm})),1,0,0,0)

Use the following as the record selection formula:
(
{table.field} >= @StartDate
)
and
(
{table.field} <= maximum({?daterangeparm})
)

This assumes that you're using a date range parm.

Now use Running Totals with an evaluate use a formula to get the parameter filtered numbers ({table.field} = {?daterangeparm}).

Use conventional sums (right click a field in the details and select insrt->summary->Sum) for the totals.

If you do decide to use a subreport becauses of something you haven't shared or whatever, then join via the same start date formula (and the parm) to the field
in the subreport, then go into the subreport and alter the = to <= and >= for the 2 different dates passed.

-k
 
I think you are right. I could be using running totals instead of a subreport.
I think I forgot to share something and ended up explaining myself poorly.

Sample Data:
[tt]
Date Inv Division Total
----------- --- -------- -----

2-Jan-2003 1 South 1,200
2-Feb-2003 2 South 100
15-Feb-2003 3 North 1,000
15-Feb-2003 4 South 2,000
[/tt]
Assuming that the user selects a date range of 1-Feb-2003 to 15-Mar-2003, I want something like:
[tt]
South
^^^^^
2-Feb-2003 2 100
15-Feb-2003 4 2,000

Inv Count: 2
Tot Inv : 2,100

+- Year to Date --------------+
| (1-jan-2003 -> 15-Mar-2003) |
| Inv Count: 3 |
| Tot Inv : 3,300 |
+-----------------------------+

North
^^^^^
15-Feb-2003 3 1,000

Inv Count: 1
Tot Inv : 1,000

+- Year to Date --------------+
| (1-jan-2003 -> 15-Mar-2003) |
| Inv Count: 1 |
| Tot Inv : 1,000 |
+-----------------------------+
[/tt]
In my current solution it is the year to date section that is the subreport that is not refreshing. It gets the DateEnd and Division as parameters. The subreport calculates a new start date and basically runs the same report (which is why I agree that I could probably be using running totals), but hides the detail section.

The concern I have with your solution is that I would end up displaying data outside the initial date range. Did I miss something (which is very likely)?

Is it possible to hide a detail record if it meets certain parameters? That way I can just display it if it meets the same parameters as the running total for the summary (or is this exactly what you are talking about[smile]).




_______________________________________
Ignorance is a beautiful thing:
You don't know what you can't do...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top