Collect all data from Crystal Report - crystal-reports

I have a crystal report containing multiple subreports. I need to find the way to 'collect' all the data printed on the report/subreports in the following (or similar)
format:
Page1:FieldName1=Value1|FieldName2=Value2|...|Page2:FieldName1=Value1.1|FieldName2=Value2.1|.....
So, the important note is that there is a possibility to figure out on which page (in the PDF generated from report) the particular field value occured.
I tried to do some complex formulas which would 'remember' all the data in a cumulative string within formula(s) (WhilePrintingRecords) but the part I can't achieve is to associate each value to correct Page number of the main, top level, report (the page numbers are of crucial importance in this purpose).
The problem is even more complex because of the groupings and linking applied in main report and subreports, so the Page numbers is at the end of the printing kinda changed comparing to design time order.
Can anyone come up with any idea please?

Thank you Siva, your reply led me to another thing to investigate (I'm new to Crystal Reports) - the issue was actually not related to incorrect execution of the formula keeping the page counter, but rather the one more formula I thought was not executing, since I didn't know that if formula is in the section which is suppressed (and hidden) IS STILL EXECUTING. The counter always counted one more page which was sufficient. When I removed that formula that I didn't need - it worked just fine. So, it was my fault :(

Related

Display multiple columns in a group header with charts

I want charts generated for each group to appear in a multi-column format in one group header. I could do it with subreports, but I'm looking for a solution that doesn't require me to load the data set multiple times. How can I achieve this?
Long story short, Crystal isn't a good fit for this.
Even if the number of groups wasn't variable, Crystal reports is fixated on delivering and iterating your records from top to bottom. It's not impossible to structure that, but it would be way more work than it's worth. Plus you'd waste too much time handling the variable number of charts and ensuring unused ones were suppressed. And even then, you'd probably need to use subreports.
You'd have better luck using something other than Crystal for generating this behavior. Even if it meant creating a subreport for the chart and writing a VS program that displayed that report multiple times for each "Group".

Crystal Reports - Remove Excess Records

Good day everyone. I would like to ask for help regarding printing records using Crystal Reports.
My aim is to print all the records in the report. The problem is that when I have only two or three records, the form will still print a space to forcibly expand it into a one whole page.
What I have did is to manually place all the parameters in the form, and add a record number parameter built in the Crystal Reports Designer. I loaded a dummy record with nothing in it. Now when I run a report wherein I have only two to three records, I have this output.
How will I work out this problem? I can only find in the Internet about shrinking, but not expanding.
In the Section Expert, check 'Suppress Blank Section'. Hope that helps

Crystal Reports : This group section cannot be printed

I'm currently modifying an existing report and replacing the data source used in the report. The reason I'm not creating a new report is because the report is laid out exactly how I would like it to be laid out. I've updated every field with the new data source fields and checked that the formulas are all correctly formatted.
Everytime I attempt to view the report (I'm using the Crystal Reports tool in VS 2010), I get the error "The group section cannot be printed because its condition field is nonexistent or invalid. Format the section to choose another condition field."
I've read another question from stackoverflow but still can't seem to find out what is wrong with my report.
First of all, why doesn't Crystal tell you more specifically what is wrong?
Any suggestions or hints?
My first thought is that you didn't update the Groups correctly when you switched backends. Go into your Group Expert. Do you see any groups simply labeled with question marks? If so, there's your problem. Go into the options for that group and choose an appropriate grouping field.
Also, use the Database->Verify Database command to look for other possible errors.
As for your question about Crystal's design, I believe that it does give reasonably accurate error messages, especially considering everything that can go wrong with any one report.

How can I build a table of contents in iReport/JasperReports?

We use iReport to enable our customers to generate catalogs for print for their products. This process works GREAT. One of the things we've struggled with is how to create a table of contents for these product catalogs.
I decided to use the Scriptlet functionality to give this a shot. Note that our reports are all master-detail in nature, in that there is a master report and a subreport.
At first, I attached the scriptlet to the master report, and tried to find a way to collect all of the product numbers in the detail report, then pass that value back to the master report. I can't figure out how to get the detail information back to the master report, as it appears that you can only pass default variables from the subreport back to the master (eg PAGE_NUMBER, COLUMN_NUMBER, PAGE_COUNT, COLUMN_COUNT).
So then I tried attaching the Scriptlet to the detail report. Well, the detail report doesn't know what page the master is on, so I started passing the master's page_number into a variable in the detail report. That worked great, except that sometimes the detail can overflow to the point that page numbers from the master are skipped. In other words, if a subreport returns more than two pages worth of data, you are going to miss a page number when the subreport is called the next time.
So how to do this?
I found an approach that worked, similar to one of my ideas above. First of all, I could NOT get a subreport to return a value to the calling report, and then retrieve that value using getVariableValue from inside a scriptlet. I tried forever, and I just could not get that to work.
Instead, I went with the approach where I attached the same scriptlet to both the master and subreports. The scriptlet has a class variable where I can keep a running tally of all the product numbers I encounter in the detail, and this code goes inside the afterDetailEval() method of the scriptlet. Note that I only want this code to run for the subreport, so I do a check to see if a particular detail field, which will never be null, is present. If it's not, I don't run the code. So when that event is called by the master report, the code doesn't run.
Now for the part that I learned from the example. The admirable side-effect programming in the example is that there is a line of dimensions 1x1 that contains a call to a custom scriptlet method in the "Print When Expression" property. That's a great idea! So this custom method returns false no matter what, and the line never prints. I did the same thing in the Page Footer band, and this method collects the values from the class variable, determines the page, and stores the results in a hash. Then it resets the class variable.
In the Report Summary band, I have another line that will never print, that calls another custom method. All I do here is iterate through a map of product numbers and show all the pages each one appears on. Done!
There is an example of tables of contents (with subreport) in project folder jasperreports-x.x.x/demo/samples/tableofcontents.
And see the hyperlink example also.
Hyperlinks, Anchors and Bookmarks
JasperReports allows you to create drill-down reports, which introduce tables of contents
in your documents or redirect viewers to external documents using special report elements called hyperlinks.

Composite reporting, Crystal Reports difficult to manage

I was wondering if someone had a suggestion on how to best do composite reporting.
I have tried to accomplish this with Crystal Reports [CR] (The one that comes with VS2k8) but for a codemonkey like me, it's hard to grasp the design part...
I have found that CR works nicely for reporting on tabular and repeatable data, but I can't grasp how to do what I want it to do.
What I want is a nice front-page, with title, subtitle and possibly some other text.
Maybe a TOC.
A summary report, consisting of some calculations and text-summaries calculated beforehand (not using the reporting tool).
Then a listing of one type of data, normal tabular.
Then another type of data, also tabular.
Then a drill-down on the first type of data. (Every "line" in the first type has 1..* associated items).
It looks to me like I have to do them all in separate reports, then "concatenate" the resulting reports to one another to get one report. And the front-page and the summary page I have no idea how to do at all.
Is there a better tool for doing this? Or does anyone have a good "quick-start" on composite reporting with CR? :)
EDIT: Oh, and these will only be used in printed-form. So no dynamic drill-down and such are necessary.
I create sub-reports and insert them into a footer section of the main report to create composite reports, using seperate reports as you suggest. I've searched myself, and failed to find any reasonable alternative. This approach works well enough and results in a single report file when done.
In my experience, Crystal is a pain in the butt for doing anything like a fixed page layout (ie: the title page). I usually put the title page in the report header (make sure to select "new page after" in the section options). Everything else pretty much has to go into subreports.
If you need to share totals and such between subreports, you need to use a shared variable in a formula field:
shared numbervar whateverTotal:= sum({whatever});
and then in the following reports, just use:
shared numbervar whateverTotal;