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!

Help with a Formula in subreport

Status
Not open for further replies.

MaryBarbara

Programmer
Nov 19, 2003
6
US
I have an XML file used to print data onto a form that is exported to a pdf (Adobe) file. The data in the XML file is yearly information.
Example:
1999 $10.00
2000 $20.00
2001 $15.00
2002 $0.0

I need to find a way to display only the 5 most current years and then print a new page to show any preceeding years prior to the last 5 years.
If there are no previous years, then don't print the second page.

I'm new to Crystal Reporting and reviewing some of existing tips in forum, but can't seem to find anything that I think may assist me.
Currently the report prints all years in ascending order, and is done within a subreport off the main report. I need to make this reporting change soon, and I'm not sure where to start. Can anyone point me in the right direction as to what I need to do? Sort Groups, parameters, formulas?

I have Crystal Reports for VisualStudio.Net 2003.
I appreciate any help that's out there.
Thanks,
MB
 
If each year's data represents one detail record within the subreport, then within the subreport, you could go to format->section->details->new page after->x+2 and enter:

recordnumber = 5

This would create a page break only after the fifth record, with all remaining records on the following page.

-LB
 
Thank you LB. Your help partially resolved my process. I can now display only certain years on subreportA, but if more years are on the xml file, they print on the next page, overlaying data on subreportB, and Report Headers are not showing for the new list of year data.
Can I get the records that don't print on the first page of subreportA to print a second subreportA page (with report headers and page headers) without overlaying the data on SubreportB? Can I limit the number of records on page 1 of subreportA (the recordnumber = x works fine), and force another page for subreportA, and have unlimited number of records, while still being able to surpress a second page of subreportA if there are no records?
Again, Any help is appreciated.
 
If you place subreportB in a separate section, then subreport A can never overlay it. So if you have subreports in a group footer, for example, insert a group footer_b for subreport B. To prevent a blank second page in the subreport if you have exactly five records, change the formula to:

not onlastrecord and
recordnumber = 5

As far as report headers, they only appear at the beginning of a report or subreport, and there are no page headers in subreports. You can create a fake page header in a subreport by creating a formula that is true for all records in the subreport, e.g.,

{table.numberID} > 0

//Or, for a string:

{table.string} <> ""

Group on this formula and check "Repeat group header on each page." This section can then act like a page header.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top