Using Subreports in Crystal Reports in vb.net - vb.net

I have used 2 sub reports in my crystal report. Both these reports are from separate tables having no connection between them...I have inserted these reports in the details section....I have used dataset to pass source data to these reports...But when i view the report, the sub reports' data isn't filtered according to the dataset rather all the rows are shown in the reports.. How can i get rid of this problem....i just want to view the data like if user wants to view a report for 2011 then it should only show information from the database records having 2011 as the Year part...Can anyone help me on this

The solution to your problem is dependent on how your user specifies the criteria for the report and where in your application they enter that criteria.
For example, if you provide a prompt for the user within your application to get the year for the report, then retrieve the datasource and pass it to crystal, then you should filter the data in the datasource before passing the datasource to crystal. You could also set parameters in crystal to filter the data, but my rule of thumb is to retrieve as little data as necessary to provide the required information.
However, if the user is prompted from within crystal reports for the criteria, then you need to use standard crystal functionality to filter the data. This involves adding record selection formulas using the user entered parameters.

Related

SSRS: How To Create Dynamic Report With Multiple Subreports?

I am still fairly new to SSRS, and I do not know what I need to/can provide as examples to help clarify my issue.
I am developing an SSRS report that accesses a NAV database and generates a report for an equipment number. My task is to generate a master report that can print multiple of those kind of reports(currently 10 max). I am using sub-reports to get the content that I need for an equipment number.
I am looking for a way to make this dynamic, where I can generate 1 to n sub-reports based on how many values were picked for the multi-value parameter. The end result should be one PDF file that contains the full report for each equipment number listed. I am trying to only use SSRS.
I have seen where I could hide sub-reports then make them visible if a condition is met, but this isn't the functionality that I am looking to use. So, what would be the best way to dynamically generate sub-reports based on a multi-value parameter?
I figured it out. I made the sub-report parameter equal no value. I made the main report with a parameter that can select multiple equipment numbers, a list, and a data set which filtered down to the appropriate equipment numbers to avoid duplication. I made the sub-report object in the main take in the cell value from the list equipment number. When the list proceeded to the next row, it copied all of the objects in the box area.

Using CR subreports for displaying two distinct reports in one blank main report

I have written a sql query for a view that return some information but when grouping in a CR report some data gets mixed and exact data is lost. what i did is to create two reports when testing, each report return the data i want ( one report for canceling fees and other for earnings ). I then had the idea to create two subreports for each correct report and display both of them in a main report. both report use a SQL view and have formula fied which filter some dates.
When i try to display those subreport in a report all i get is a blank report with no data. i tried to link those subreport with a field but eventough. no data was shown.
Could someone point me some track for getting this work ?
Thank you in advance

How do I get the index of each record displayed on crystal reports?

I'm developing winform application using vb.net. I use crystal report in my application. Now i need to store the index of each record that is displaying in current report into database. Then i create another report which displays the index of all the records. My plan is to read the page number of each record and save them on database. I have a group field in the report. I don't know how to scan one by one record and get appropriate page number. I tried the following code to get the field value but did not work.
msgbox(rpt.DataDefinition.FormulaFields("name").Text)
It displayed the formula of that field.
I don't know in which order the records fetched using following.
msgbox(rpt.rows(0).item(0))
Please Help me out....
The way your question reads, it sounds like you're trying to generate an "index" for the order records appear in a report and store that index in a database for use in another report. I am not clear at all what you're trying to do with the page number.
In any case, I need to make something clear: the definition of the report (which you're accessing in your code sample) only represents where data will go when the report is formatted - it is not the actual data itself.
At the most basic level, Crystal Reports takes data out of a database and formats it nicely for you on pages. Rather than trying to take data out of a database, put it into a report, then try to read that report to put it back in a database to make another report, why not just do all your data manipulation at the database level itself before going to a report in the first place?
If you really must have that first report, the easiest option you'll have for getting at the formatted data is to export it to excel and access it programmatically through an Excel API - Crystal Reports doesn't have an API for getting at your formatted data (including things like generated page numbers, whatever you're trying to do with them).
You are trying to break few basic rules. For example a report should never change the data. The right way is to handle data processing in a stored procedure or command and to call the report in a separate process. In such way you will be able to control the data change and data visualization separately.
P.S. You probably mean "Identifier" not "Index"

Show different report in Oracle based on parameter

I'm using Oracle report builder and I have to show summary and detail reports. This tool does not have drilldown capability. I need it to show the either the detail or the summary report based on a parameter that the user enters at the beginning. Can anyone tell me how to dynamically display either one or the other report based on the user parameter entered?
You will use a repeating frame to display the content and you can set the visibility of this frame according to the value of your report parameter.
So you will just have two of these - one for your first select and another one for the second.

Substitute one table for another at runtime

I have 9 tables with state information in them. They all have the same field names. I have a Crystal Report that is based on one of them. I want the user to be able to select a state and change the Crystal Report to use that table instead of the one it was based on.I mean when user select text in combo box and then click on "OK" then report show (using only one rpt for all the tables of same fields).
How do I do that in VB.Net?
Could you base the Report on a Stored Procedure and pass in a parameter so the Stored Procedure knows which table you want the data from?
I remember trying to get a Crystal Report (v2005) to switch database source from the one it was designed against and that wasn't easy - every table had the connection details in it if I recall correctly! (maybe changing tables is easier though)
It's not easier but if the tables have the same structure you should be able to do it. But you should create a new Document for it and call SetDataSource for your new table. After this you can set the document as ReportSource to your viewer.