Is it posible to put crystal report file in some site, like :
http://localhost/DocumentRPT/ProductPerTenorByProductID.rpt
And then, I executed with
ReportDocument.load(serverPath)
Or, any suggestion in common publishing method?
Many thanks for the answer.
there is property of report viewer ReportPath you can assign it from code behind
ReportViewertrans.LocalReport.ReportPath = HttpContext.Current.Server.MapPath("Your path to rpt");
or
report.Load(Server.MapPath("Report1.rpt"))
Related
I am having a hard time with this one and I assume it is something I am missing as always.
I am using Visual Studio Web Express 2012. I have installed Report Builder and Report Viewer 11. I have created a generic report file in the report builder as I can not seem to view any designer view in Visual Studio. Not the issue. I am pulling data from my SQL database as usual and populate a dataset. All is fine from here. I can not seem to get the data to show in the report view but can not figure out what I am missing. I have looked everywhere on the web as well as Stack specifically. I have used some of the sample codes and have gotten the report to now show up but still no data. Any help would be great.
I create a generic report file in report builder. No fields, no title etc., just the generic report. This may be my issue but I can not seem to figure out what I am missing.
On my page load I populate the dataset as always with no problem as I can display the data in a label etc.
I add the report viewer to my page and add the following code to the page load after the dataset fill. I also noted that you must use if page.postback = false as Ajax seems to not like it otherwise and just seems to loop and continue loading forever.
I have tried many different code ideas but found I finally got the report to load (again no data) with the following.
rv1.Reset()
rv1.LocalReport.DataSources.Clear()
Dim rds As New ReportDataSource("DataSet1", tempDS.Tables(0))
rv1.LocalReport.ReportPath = Server.MapPath("\tests\test.rdl")
rv1.LocalReport.DataSources.Add(rds)
rv1.LocalReport.Refresh()
Again this is VB.Net webpage. What am I missing? Thanks in advance.
Did you bind the datasource? Sorry if i'm wrong, but in C# asp.net you need to bind the datasource after using an atribution.
I created a report to my object by open office openerp report designer extension,
on my report i need to call the function process, so i need to attach a parser to my report to get my function.
i defined a parser:
how can i attach my parser to the report i creayed, i need my report to be .odt file
Thank you.
please add the following line at the end of your parser.
report_sxw.report_sxw(
'your.report.name',
'your.openerp.model.like.product.product',
'addons/your_module/report/rml_file_name.rml',
parser=notariat_report_contrat,header="external"
)
Thats it. parser is attached with your report.
I've created a simple report in vs.net 2008 with stimulsoft report 2013.
I'm using these codes to show report:
StiReport1.RegData(ds)
StiReport1.Render()
StiReport1.Show()
when I click on the button I Can see the report correctly for the first time.
but when i close the reportviewer's Windows and click on that button again the
report is empty (I can see the header or footer but no data loaded on the report)
I think the report data not load again or something saved on cache.
please Help.
Thanks
SOLVED
Try this code. its work for me
StiReport1.Dictionary.DataStore.Clear();
StiReport1.Dictionary.Databases.Clear();
StiReport1.Dictionary.DataSources.Clear();
StiReport1.BusinessObjectsStore.Clear();
StiReport1.RegData(ds)
StiReport1.Dictionary.Synchronize();
StiReport1.Compile();
Try this method:
StiReport1.ResetRenderedState();
The problem solved.
I should just save the report and load it each time:
Dim rpt As Stimulsoft.Report.StiReport = New Stimulsoft.Report.StiReport
rpt.Load("report/MyReport.mrt")
rpt.RegData(ds)
rpt.Render()
rpt.Show()
You need to reset your Viewer before rendering. Use ResetReport() function before Reg and Render codes.
I did all the steps from this waltrought:
http://blogs.msdn.com/b/sqlforum/archive/2011/01/03/walkthrough-add-a-subreport-in-local-report-in-reportviewer.aspx
and when i run it i get the first father report and instead the sub
report i get:
Data retrieval failed for the subreport, 'Subreport5',
located at: C:...
i attach a print screen file
i am using VS2010 framework 3.5.
Can you run the subreport by itself, given the right parameters? If you can't, your problem is that.
If you can run it successfully by itself, double-check that you are passing the parameters correctly to your subreport. Make sure the parameter types match and that you are passing all of them.
Another problem might be that -- if I recall correctly -- when you have a subreport in a local report, you need to provide the data for the subreport programmatically, just as you do with the parent report. There's an event that's raised - SubreportProcessingEvent -- when the subreport is being processed. You write a handler for that event and supply data in the handler. Here's some more information about it: LocalReport.SubReportProcessingEvent. There's a good example on that page.
Was helping a friend who has some 100+ "Crystal Reports 2008" reports as part of a "asp.net website project".
I do not know how/why, but when this "asp.net website" project is building, it spends about 15 minutes "building" the reports directory where all the Crystal Reports reside.
Can Crystal Reports files .rpt's even be build/compiled? Actually it looks like they can be an embedded resource. Like for example according to this article http://msdn.microsoft.com/en-us/library/aa287962(VS.71).aspx you should be able to change whether a report is embedded or not from properties, BUT in "asp.net website project" those properties are not available when a report is highlighted in sol exp.
When the website is build and published, all report files are still put into a corresponding reports folder.
So I guess, my question is there any way to stop VS from building Crystal Reports in "website project"? It's just takeing sooo long it's unbearable.
Thanks for all the suggestions. Turns out it was set up to be embedded as a resource..which with near a hundred was killing the build. Set it to false and the build is in less than a minute.
<businessObjects>
<crystalReports>
<rptBuildProvider>
<add embedRptInResource="false"/>
</rptBuildProvider>
</crystalReports>
</businessObjects>
We use crystal reports in quite a few different apps/web pages. In none of them do we actually include the report files themselves within the Visual Studio project. We put the files in the something like a /Reports sub directory, and then reference them by filename. We're still using a fairly old version of Crystal, but I wouldn't think they'd take something like that out.
We use code something like the following:
Dim myRpt As New ReportDocument
Select Case strFormNum
Case "M5044b"
strReportPath = Server.MapPath("/Reports/M5044b.rpt")
<..Snip a lot of case statements...>
Case "M5238aWithAI"
strReportPath = Server.MapPath("/Reports/M5238a_WithAI.rpt")
End Select
myRpt.Load(strReportPath)
myRpt.SetDatabaseLogon(strCRUser, strCRPassword, strCRServer, strCRDB)
myRpt.SetParameterValue("#nIndex", intNewIndex)
myRpt.DataDefinition.FormulaFields.Item("Version").Text = "'Report Printed: " & Now().ToString & "'"
oStream = myRpt.ExportToStream(ExportFormatType.PortableDocFormat)
You need to make sure that custom tool is not run on each report. By default when you add a crystal report to a project, it will associate this custom tool that generates a wrapper class for the report. It's much faster to reference the report by filename (as Josh W. demonstrates), and keep the reports out of the assembly.