SSRS main and sub report parameter issue - ssrs-2008

I'm using Visual Studio 2008 BIDS to create a report that contains a sub report. This is only the second ssrs report I've created so forgive me if I'm not using the correct terminology. Right now when I try to preview the report in BIDS I get this error message:
[rsWarningExecutingSubreport] Warnings occurred while executing the subreport ‘lineItemsSubReport’.
[rsNone] The report parameter 'salesOrderId' is read-only and cannot be modified.
[rsNone] The report parameter 'salesOrderId' is read-only and cannot be modified.
[rsNone] The report parameter 'salesOrderId' is read-only and cannot be modified.
[rsNone] The report parameter 'salesOrderId' is read-only and cannot be modified.
On the subreport, my parameter was set to internal, but I have changed to it hidden.
I'm using FetchXMl for the query for both reports.
My main report contains a data set that has a field called salesorderid. I'm trying to pass this value to the sub report doing this:
<Subreport Name="lineItemsSubReport">
<ReportName>LineItemsSubReport</ReportName>
<Parameters>
<Parameter Name="salesOrderId">
<Value>=Fields!salesOrder_salesorderid.Value</Value>
</Parameter>
</Parameters>
<Top>0.38542in</Top>
<Left>0.125in</Left>
<Height>0.62499in</Height>
<Width>5.98958in</Width>
<ZIndex>1</ZIndex>
<Style>
<Border>
<Style>None</Style>
</Border>
</Style>
</Subreport>
In my sub report I have a filter on the query and a Query Parameter named salesOrderId and a Report Parameter called salesOrderId. Is this setup right? If not how do I setup the sub report to get the parameter that is passed from the main report? This seems like it should be easy, but it's being a bit of a pain.
Thanks!

Well I somehow got it to work, but I'm not quite sure what excatly I did that did it. I will post the answer if I figure it out.

Related

iReport parameter not being informed by field

I am using iReport - my first time using it - and I am trying to make a report that will involve passing a parameter to a subreport. I am not able to get that to work, so I did the following test:
I have a large query that grabs various Fields from my DB - when I preview the report these fields are being pulled and display (over and over, etc., a lot of stuff is being pulled).
I created a new parameter on the main report called "myparam". I made it's default value one of the fields that is being successfully pulled from my DB.
I created a textfield to display this param - the intent being it will echo the field that displays already in my report. If I can get it to do that, I figure I can get it to correctly "plug in" to my subreport.
The issue is - when I preview, I am asked to give the parameter a value - I choose default, which defaults it to the Field I set, which means it should now echo that field (aka I WANT it to echo that field). But it does not echo that field. Instead it just shows null over and over again. Here is a screenshot of what I am talking about
Here is the setup for my report:
Here is proof I've set the default value in my xml:
<parameter name="myparam" class="java.lang.String">
<defaultValueExpression><![CDATA[$F{TCORDERID}]]> </defaultValueExpression>
</parameter>
Here is a snippet of the report which is being generated incorrectly (aka myparam is not getting populated right).
THEY ARE BOTH STRINGS
From my understanding of parameters, they are passed to the report/subreport when it gets created. You have set the default value of the parameter to one of your fields, which has not been populated yet when the report gets generated.
I would suggest adding a simple subreport (which is the reason you want to use parameters anyway), remove the parameter on the main report, and add it to the subreport (with a text field to display it).
Now, add the Parameter to the subreport object in your main report. (This is under the Subreport properties section in iReport.
Name: The name of the Parameter in the subreport.
Expression: The field from your main report that will be passed to the subreport.
So your main report will have the following under the subreport detail:
<subreportParameter name="myparam">
<subreportParameterExpression><![CDATA[$F{TCORDERID}]]></subreportParameterExpression>
</subreportParameter>
And then the Parameter in the subreport:
<parameter name="myparam" class="java.lang.String">
<defaultValueExpression><![CDATA["No result"]]></defaultValueExpression>
</parameter>

iReport, subreport does not appear

i'm trying to add subreport to report.
I have setted connection type to "use a connection expression" and the expression is $P{REPORT_CONNECTION}.
My subreport contains a simple query and some static text, when i test it all works good, but when i test mainreport the subreport does not appear.
I have some static text in subreport, this one should be display always, isn't true? But i can't see it...
During compilation i have no errors, and subreport path seems correct becouse a message say "subreport.jrxml already compiled.".
What can i do?
Thanks.
The solution is pass HIBERNATE_SESSION as parameter from master report to subreport.
Please Right clik on sub report and clik on open sub report if your sub report gets open then your reporyt is connect with your sub report. if subreport is not open do the right connection for that.
if your subreport is work for the parameter value with seperatly and displyes the static text and detail band values it is sure that the report will come ffrom main report.
but the report displays only static text and the text is in title or page heder, then you have to go to the report property and set the output when no data then choose diplay all section data from combo. your static text will apper from main report.
When you add a sub-report in your main report, the sub report expression will refer your locally saved sub-report path. Ex: "C:\abc\xyz.jrxml".
Now you can preview your main report containing sub-report in your ireport.
Once you publish the main report in Jasper server, the Sub report gets loaded into jasper repository and its expression becomes "repo:Repositorypath.jrxml".
Once sub-report contained report is published into Jasper repository, its path will always refers to Jasper repository path and because of this reason, you will not be able to Preview the main report in Ireport.
So, execute the report in jasper server directly once you publish the main report instead of previewing or opening the subreport in Ireport.
Thanks,
Srikanth Kattam

JasperReports: How to pass parameter to subReport

How to pass parameter to sub report in JasperReports?
I'm able to pass the parameter to master report but I'm not able pass parameter to its sub report.
Can any one give me the solution for it?
Try using iReport if you are not.
When viewing a report within iReport you can select the properties of the subreport within the main report.
In this there is an option in Subreport properties called Parameters. Using this you can pass parameters to your subreport.
Select this and click the Add
button.
Then click the button right of the
Value expression Box
Next an option screen will pop up
where you can select the parameter
from the master report you want to
pass.
If you want to do it via xml here's a quick example.
<subreport>
<subreportParameter name="XML_ID">
<subreportParameterExpression>
<![CDATA[$P{MASTER_REPORT_PARAMETER}]]></subreportParameterExpression>
</subreportParameter>
</subreport>

Subreport not displaying data

My Crystal Report is generated in Visual Studio 2008. I've linked the subreport parameters and everything runs fine when I run it from the report previewer within visual studio.
But when I deploy the report to the production server, the sub-reports don't have any data at all, even though the main data runs fine. What might be causing the subreports to stop working on the production server?
Did you check DataSources for main report and sub report?
Did you check if sub report is embedded in the main report?
Did you deploy the Sub report if it is not embedded?
How many and what kind of parameters do you use Dates, Strings, Integers ...
What is the error do you get? This should give you some directions where to look for a problem.
Can you try some other sub reports instead of the failing one.
And finally, use the old computer trick. Remove the sub report and then create/embed it again.
Right click your subreport
Open "Change Subreport Links"
Make sure you have chosen one field from the "Available fields" section.
In case you have parameters in your report:
Have you tried showing the report from code instead of previewer? Is that different? If yes then probably there's a mismatch between your data input from code and previewer
I was facing same issue and changed my code from this:
for (int i = 0; i < SbRptDtSrcs.Count; i++)
{
rpt.Subreports[i].SetDataSource(SbRptDtSrcs[i]);
}
to:
rpt.Subreports["rpt1.rpt"].SetDataSource(SbRptDtSrcs[0]);
rpt.Subreports["rpt2.rpt"].SetDataSource(SbRptDtSrcs[1]);
and it worked.

How can I disable Parameter Prompt at run time in Crystal Report XI?

How can I disable Parameter Prompt in sub report at run time in Crystal Report XI? I used Ms VS 2005 and report also included. Other report features is the same Crystal Report features. Other report not show prompt at run time which are not included Sub report. Prompt appeared one is included sub report. so you may hv any suggestion. let me know pls. thanks.
I solved it from this web site: http://www.it-sideways.com/2011/10/how-to-disable-parameter-prompt-for.html
Take a look at this link.
Pass parameters to a stored procedure in a Crystal Report sub report?
Here are two other links that could prove helpful as well.
passing parameters in crystal report
http://www.tek-tips.com/faqs.cfm?fid=1329
We had the same issue and resolved this by modifying our code that prints the report.
Instead of setting the ReportSource of the CrystalReportViewer before setting the report parameters, set it after you have added all the report and subreport parameters.
I just solved it with something very simple, I don`t know if it works in every case but in my case it did.
Solution:
Go to Properties of your CrystalReportViewer and set ReportSource=None
Use following steps
Don't use CrystalReportViewer1.RefreshReport or CrystalReportViewer1.Refresh
Set Report source from properties to none
Report source must be assigned Dynamically
in your code have this sequence
REPORT1.Refresh()
REPORT1.SetParameterValue(0, "some default value") 'assign some default value
CrystalReportViewer1.ReportSource = REPORT1 'dynamically assigned report source