Trying to remove exisitng parameters in Crystal Report 10 report by creating new subreport to provide the parameter data - crystal-reports

Hello: I am trying to run crystal report 10 report from command line (and I'm new to crystal). The report has two date parameters ?from and ?to. I can query a different database to get the ?from and ?to parameters. So what I'm trying to do is get rid of the external parameters by generating the dates from within the report to replace/populate ?from and ?to.
Can I somehow add a sub-report to query Oracle to get the ?to and ?from dates? This new sub-report would need to run first since the other four reports (3 subs and 1 main report hitting SQL server) all use these date parameters?
Thanks for any help.

To the extent I know, Whether you use sub report of main report if a user needs to enter his own parameters to query the database then you need to create external parameters
Edit------------------------------------------------------------------------------------------------
Since you are trying to get the date input from different database... your approach is correct to create a sub report for this.
Make sure to place the sub report first in order from where you are taking the values.
Either use a shared variable or through parameter linking get the date values to main report and pass the values to remaining sub reports through linking option in sub report links.

Related

Passing parameters start and end dates from a stored procedure to the main report and three subreports

I am using a stored procedure in SQL Server 2016 to pass parameters (startdate and enddate) to the main Crystal Report and three subreports. Right now the report is asking four separate times for the start and end dates. I only want to enter the start and end date once and pull all the information for all the reports. Is there a way I can do this?
You are getting 4 times because you haven't linked the parameters from main report to sub reports.
First create the parameters startdate and enddate, Now in each sub report create parameters with same name.
For each and every sub report right click --> change sub report links add the startdate and enddate and in the right side bottom of the box you will get the drop down to link the added parameters to sub report parameters, There select the already created parameters.
This way main report and sub report parameters are linked, Follow the same process for all sub reports.
Now when you run the report only once parameters are prompted

Passing result of a query as parameter in Crystal Report

I am new to crystal report, I have a report to generate which contains two queries.
I need to run the first query which returns a single column.
I need to fetch the result of the first query one by one and pass it as a parameter to the second query. And finally running the second query.
It would be helpful if anyone tell me the steps about how to do this.
I am using crystal report 2008, I hope the above mentioned information is sufficient, if not please let me know.
you need to use sub reports for this purpose...
Take query 1 in main repoirt and query 2 in sub report. Place the sub report in the section that is coming after the data in main report.
Then pass the filed of mail report to sub report using the sub report links and then apply condition on this field in sub report Record Selection Formula

Pass parameters from main report to sub reports

I have searched many sites for this but the suggestions do not work. I set 2 parameters on the main report. I have added the 2 sub reports, both are to use the same values of these parameters. The 2 parameters are date values I need to use as a date range in the select expert where I am using a Is Between check. I right click on the sub report and click the Change the sub report links. When I select the parameter in the Available Fields: drop down the Select data in subreport based on field: is not populated with any choices - which was one of the suggestions I read about. Can someone walk me thru this process?
Thanks
You have to create parameters in your Sub reports first for them to appear in the Connecting list and then map to main reports parameters

Passing values from main report to subreport in JasperReports

I have a simple select sql query with 2 parameters that I want it to be in my query text in main report. It returns about 100 values that I want to put in 10 subreports (10 values per subreport). On main report I need to display only one parameter. All the values from query I need to be in subreports. How do I pass them?
Connection to database is returned to me from application, parameter values also. I'm using iReport 4.7.0.
Parameters are attached to the dataset, if you expand the dataset itself, you'll find a section there for parameters, just like in your main report.
You'll need to link the parameters together though, using the connection properties where you're actually using the dataset, eg, in a chart or a table. For example, in the table, you go to the dataset tab of the properties pane, and click on the parameters button to map the parameters between your main report and your sub dataset.
More here.

Iterate through data table in Crystal Report

How can i create function to iterate through datatable to read value from table
e.g
Function GetVal(integer id)
//iterate here and match value from table using id
return value;
and call this function on report field
i am using crystal report 11
any clues??
Option 1: Make your function (or equivalent SQL query) outside of Crystal and link to it like any other source. The practicality of this option depends on the details of your report.
Option 2: Crystal doesn't have a built-in Get() function that I can find. So, you'll have to get creative with subreports. For example, let say's say you want to get {TargetFld} from {LookupTable} based on {CriteriaFld}:
Make a subreport. Use {LookupTable} for your data source.
When entering subreport links, choose {CriteriaFld}.
In your subreport, make a formula. Use it to create a Shared variable and set the value to whatever value you want to pass back to the main report.
Position the subreport 1 section above the section where you need to use this value. (Otherwise it won't evaluate when you expect it to).
Create the Shared variable in the main report.
Use it as normal.
If you're not familiar with subreports or shared variables, I suggest first looking them up in the Crystal help files (F11). This will make alot more sense that way.