I am using Visual Studio 2008 and Crystal Reports that is shipped with it. I would like to set certain properties of a chart such as Chart Title at Runtime. I have tried via ChartObject but there are only limited properties such as top, width, height etc. and not the properties I'm interested in. I included "craxddrt.dll" in my solution which provides IGraphObject but am obviously trying to cast the wrong class with it as it returns an invalid object reference...
(myReportDocument.ReportDefinition.ReportObjects[0] as IGraphObject).Title
Any help in retrieving the chart properties would be much appreciated...
thanks,
Paul
Instead of trying to set the chart title at runtime, set it to be blank and display a Crystal formula in the same place.
Related
I have a Crystal report with several subreports linked on a common field - all working great. Now must add another, very complex, existing report as a new sub. This report's data source code stretches several pages. It also has over a dozen parameters which are further imbedded in numerous formula fields through out. That said, it runs fine and has a parameter that links with the main report. Unfortunately all the other parameter prompts is supremely annoying.
I've searched high and low for a method to accept default values without prompts but Crystal doesn't seem to accommodate that notion.
Revising the report to remove all the unneeded parameters would be extremely painful and simply not an option.
I'm hoping to find an alternate way to pass the parameter values to prevent the prompt. I'm aware of the SetParameterValue() method of the ReportDocument class but not sure how to use it. I've found examples of how to use it with C#, VS, ASP.net, etc., none of which work for an end user like myself.
Could the data source command itself be used?
Much thanks for any recommendations, guidance or thoughts!
With Command Level prompts, you would never be able to change the prompt values with the CR Viewer.
If the report is supposed to be viewed in the CR Viewer and you need the functionality or changing prompt values, try this:
1) Remove Command Level prompts
2) Create the Data prompt in the report from the Field Explorer
3) Create a Record Selection formula like this:
{date_field} = {?Date_prompt}
under Report > Selection Formulas > Saved data
4) Save the report with data
Try this...
I am using the Crystal Reports 2011 designer just to test it out. I need to be able to hide certain components, e.g. a sub-report, when exporting to different formats like Excel or .pdf. I'm guessing this can be achieved through the Suppress field with a formula, but I can't find the right syntax. Needs to be something like this:
If ExportFormat="Excel" then Suppress
Else if ExportFormat="PDF" then Show
It doesn't seem like there is a variable to represent the ExportFormat type when using expressions in Crystal Reports.
It is possible to overcome this problem by setting a parameter programmatically during an export event i.e. create a parameter #ExportFormat and during the export event set this parameter depending on the type of export e.g. if the export taking place is to Excel, set #ExportFormat="Excel". Then the following expression can be used to suppress a control:
{?#ExportFormat}='Excel'
You got it almost completely right:
If ExportFormat='Excel' then TRUE
Else if ExportFormat='PDF' then FALSE
This formula goes into the suppress formula. (You need to click this small button with the "x-2" and pencil on it...)
Can anyone let me know the purpose of property ireport.x and ireport.y in JasperReports .jrxml files?
Thanks in advance.
The parameters ireport.x, ireport.y and ireport.zoom are determine how to show report's template in iReport. Its just a settings for default displaying report in this designer (iReport).
The parameters ireport.x and ireport.y are determine the default position for template (after opening in designer).
The parameter ireport.zoom is determine the default zoom for template (after opening in designer).
Using iReport v4.0.1 with Jasperserver v4.1.0 I'm trying to find a syntax for linking subreports to the main report that lets me test it in iReport then deploy to the server through the repository browser.
The default syntax for sub-reports in iReport for the subreport expression is something like
$P{SUBREPORT_DIR} + "mySubReport.jasper"
When you deploy this from iReport it's smart enough to pick this up and suggest changing it to
"repo:mySubReport.jrxml"
and to then deploy all subreports to the Resources folder of the main report.
That's great, but unfortunately it then edits the file in iReport to save this change which means you can no longer run the report in iReport without manually re-editing all the sub-report expressions - this makes the process of testing and deploying to the server really painful, particularly when there are multiple sub-reports in a report.
I thought I could at least set the value of $P{SUBREPORT} to be "repo:" or "My\local\filepath" so that at least I'd only have one place to change it, but the compiler doesn't like that.
Is there an alternative structure or an expression that will resolve to repo:*.jrxml or My\local\filepath*.jasper correctly depending on where you're running the report from?
The best solution to this is to add an additional parameter like $P{IsOnServer}. Set the default value to true. For your subreport expression use this:
$P{IsOnServer} ? "repo:mySubReport.jrxml" : "/local/path/to/mySubReport.jasper"
When you run the report in iReport, you'll be prompted for the value of IsOnServer. Make it false; the subreport expression will resolve to your local file. On the server, don't define an input control. The users will never be prompted for that parameter (they won't even know it exists), and it will result to the desired 'repo' syntax.
An even better solution would of course be for iReport to handle this automatically... but for now you need to do something like this.
I have created .jrxml by using iReport tool and have to dynamically set the x and y position of fields in .jrxml file. How should I do that?
I'm afraid thats not directly possible using reports made in iReport, creating the reports in runtime in Java will solve your issue.