I'm creating an MVC application which uses the Reporting Web service (2010) for programatically managing reports and data sources.
About a month or so ago when I first implemented this functionality, I was able to upload reports (.rdl files) first and later upload its data source.
I was then able to view the report using a report viewer control in a web page.
However, since a week or so, this flow has broken, i.e. if I upload the report first and then the data source, the report doesn't render in the report viewer control. It gives the following error.
The report server cannot process the report or shared dataset.
The shared data source 'AW' for the report server or SharePoint site is not valid.
Browse to the server or site and select a shared data source.
The data source is a shared data source which is defined in the rdl file as follows.
<DataSources>
<DataSource Name="AW">
<DataSourceReference>AW</DataSourceReference>
</DataSource>
</DataSources>
If I reverse the flow, i.e. upload the data source first and then the report, it starts working!
But I'm 100% sure, the other flow used to work when I first implemented it.
I'm stumped as to why the original flow has stopped working.
Both the report and the data source are uploaded to a specific folder.
Can someone please shed some light on this.
Does the original flow make sense? I mean is it supposed to work, or was I imagining stuff?
btw, the data source uploaded is in the following format
<?xml version="1.0" encoding="utf-8"?>
<DataSourceDefinition xmlns="http://schemas.microsoft.com/sqlserver/reporting/2006/03/reportdatasource">
<Extension>SQLAZURE</Extension>
<ConnectString>Data Source=xxx;Initial Catalog=AdventureWorks2012</ConnectString>
<UseOriginalConnectString>false</UseOriginalConnectString>
<OriginalConnectStringExpressionBased>false</OriginalConnectStringExpressionBased>
<CredentialRetrieval>Store</CredentialRetrieval>
<WindowsCredentials>false</WindowsCredentials>
<ImpersonateUser>false</ImpersonateUser>
<UserName>user</UserName>
<Password>pass</Password>
<Enabled>True</Enabled>
</DataSourceDefinition>
and I use the ReportingService2010.CreateCatalogItem method for creating both the report and the data source.
Any help is highly appreciated.
Perhaps, my case may be useful for you. I had a task to upload reports from rdl-files to SSRS2012 before application server start. I decided to use Web Service API, not rs.exr.
After report loading by method CreateCatalogItem of class ReportingService2010 I tried to execute reports in browser and got error. SSRS could not find shared data source for loaded report. When I published reports from VS2013, reports worked properly. I could not use method SetItemDataSources , because could not get the reference to existing data source as instance of DataSource class. That is why I found following solution. The idea in that the rdl-file has only name of shared data source, not path. Therefore, if report and its data source are located in different folder, report don’t see data source. In my case my data source located in folder “Data Sources”, so it’s necessary to correct rdl-file before uploading,, as shown below:
Warning[] warnings = null;
string name = "ProductList";
string dsName = "DB_CORE";
string dsFolderPath = "/Data Sources";
byte[] definition = null;
// correct rdl
XmlDocument rdlDoc = new XmlDocument();
rdlDoc.Load(+ name + ".rdl");
XmlNodeList dsRefmodes = rdlDoc.GetElementsByTagName("DataSourceReference");
dsRefmodes[0].InnerText = dsFolderPath + "/" + dsName;
definition = Encoding.UTF8.GetBytes(rdlDoc.OuterXml);
// upload
CatalogItem report = rs.CreateCatalogItem("Report", name, "/" + parent,
true, definition, null, out warnings);
Related
I want to create embedded data source in SSRS 2014 using Visual studio 2013. But there is no item for embedded data source. How I can add it?
Thanks
You create an Embedded Data Source in the report itself, not in the project.
Create a new report in your project (or use an existing one). Then, in the Report Data pane Ctrl+Alt+D, create a new Data Source by right-clicking on the Data Sources folder.
Choose Embedded connection, the Type and populate the Connection String with the settings that are appropriate for connecting to your database.
Afterward, add a new dataset by right-clicking on the Datasets folder and choosing Add dataset. Choose Use a dataset embedded in my report, and pick the data source you created above.
The report will use that embedded connection going forward, at least for this dataset.
I have a form / report that I need to get images to display on, but they are all received in PDF format which the attachment control can't display.
To get around this I was planning on using the Adobe PDF activex control, but I can't just pass it a file path since this database will be used for reporting by people that do not have access to the network shares these PDF files will be on.
Ideally I would like to store the file in the database and then pass this stored version into the control. I am having trouble finding documentation on what I can do with the adobe pdf control.
I am imaginging something like:
AcroPDF1.LoadFile (Me.attachment)
Is this possible?
What you need a database-linked PDF viewer.
Delphi: http://www.gnostice.com/nl_article.asp?id=274&t=Data_aware_VCL_component_to_display_DOCX_PDF_BMP_PNG_JPEG_from_a_database
.NET: http://www.gnostice.com/nl_article.asp?id=279&t=How_to_save_and_retrieve_PDF_documents_to_and_from_a_database_using_C
You will have to modify the data source with a network DB.
Is it possible to generate an SSRS report in Dynamics AX 2009 and save it as a pdf file using X++ ?
The problem I have is that I need to generate the data for the report and then generate the report. Reporting server subscriptions wont work in this case as there is no way for them to call the x++ to generate the data.
I have also had a look at passing the rendering type to the SSRS report in the URL, but it doesnt seem to accept a filename to save the report as.
The logic that generates the data is not a straightforward query, and takes quite a while to run. I want to be able to turn this into a batch process so that several reports can be generated by a batch server.
Ensure that AX is configured as a batch server and then you will need to create a batch job.
The art of creating a batch class (for the batch job to call) which calls a report and generates a pdf file overnight has already been mastered here.
The following snippet for generating a PDF file is from the class EPSendDocument.makeDocument()
Filename file = "\\\\Server\\SharedFolder\\File.pdf";
printSettings = reportRun.parmReportContract().parmPrintSettings();
printSettings.printMediumType(SRSPrintMediumType::File);
printSettings.fileFormat(SRSReportFileFormat::PDF);
printSettings.fileName(file);
printSettings.overwriteFile(true);
Another link for converting a report to a pdf file.
Finally do check first if the files are generated by executing the class from within your AX client, and then when it is run on the batch server. There may be permission or path issues.
I have a server report that references a shared dataset on the server. It works fine if I add a ReportViewer to a page and set the report server URL and report path properties.
Because I need to look at the xml of the report and do some preprocessing, I:-
Manually download the report using: ReportingService2010.GetItemDefinition(path). I then convert this to an XDocument.
Do my preprocessing - this does not touch anything to do with datasets.
Load the xml definition into the report viewer using:
XDocument processedDocument;
using (var sr = new StringReader(processedDocument.ToString()))
{
viewer.ServerReport.LoadReportDefinition(sr);
}
When I attempt to view the report, I see this error in the server error logs:
Microsoft.ReportingServices.Diagnostics.Utilities.InternalCatalogException:
Shared dataset definition stream does not exist.
To get to the crux of the error, I've removed step 2 completely so that all I am doing is downloading the report, converting to xml and then loading the xml into the ReportViewer.
I do not get this problem when the datasets are embedded in the report.
Any ideas what is happening here?
ETA:
If I download the report, convert to XDocument, convert back to byte[] and then use ReportingService2010.SetItemDefinition() to save the report on the server, it displays fine in the ReportViewer (when the path is specified).
This means the problem is not in the xml<->byte[] conversions. When the ReportViewer downloads a report, using a path, it must be doing something with the referenced shared datasets that I'm not doing.
I have a workaround.
It seems to be a problem with the relative path to the shared DataSets. I presume I would have the same problem referring to shared images on the server as well.
Here's what I intend to do:
Download the report.
Perform pre-processing.
Use ReportingServices2010.CreateCatalogueItem to save a new report back on the server at exactly the same location, but using a temporary name.
Use reportViewer.ServerReport.ReportPath to reference the new temporary report.
ETA:
Actually, because the DataSet path references always start at the root, I don't think you have to store the report at exactly the same location. You can create a /Temp folder that you can easily periodically clean out.
I need to store PDF files in an Access database on a shared drive using a form. I figured out how to do this in tables (using the OLE Object field, then just drag-and-drop) but I would like to do this on a Form that has a Save button. Clicking the save button would store the file (not just a link) in the database. Any ideas on how to do this?
EDIT:
I am using Access 2003, and the DB will be stored on a share drive, so I'm not sure linking to the files will solve the problem.
We have several databases that contain 10's of thousands of documents (pdf, doc, jpg, ...), no problem at all. In Access, we use the following code to upload a binary object to a binary field:
Function LoadFileFromDisk(Bestand, Optional FileName As String = "")
Dim imgByte() As Byte
If FileName = "" Then FileName = strFileName
Open FileName For Binary Lock Read As #1
ReDim imgByte(1 To LOF(1))
Get #1, , imgByte
Close #1
If Not IsEmpty(imgByte) Then Bestand.Value = imgByte
End Function
In this case, Bestand is the field that contains the binary data.
We use MS SQL Server as a backend, but the same should work on an Access backend.
If you used the same concept but upsized to SQL Server- storing PDFs inside of an Image datatype (or varbinary(max)) then you could SEARCH INSIDE THE PDFs using Full Text Search.
I show that Microsoft says you can do this for any file type where you can register an IFILTER product.. and I just was at the Adobe website the other day and say that their Acrobat IFILTER is indeed FREE.
Maybe this will help: ACC2000: Reading, Storing, and Writing Binary Large Objects (BLOBs).
What they do: Read a file in chunks and add it to a blob using a VBA function.
A field of OLE Object, by default would use a Bound Object Frame on the form. Right click on it and you can Insert an object. It comes complete with browsing for the file. Double-click on the field and the actual document will open.
I recommend going with David's advice and link. Unless you have a need to transfer a single file and want all the PDF's included. Size and performance will be an issue.
If security is an issue and the Access file is the only control you have (You are unable to set security on the folder containing all the linked files.), then you would have to embed.