We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Starting in 2019, the Reporting control is no longer included in Essential Studio. If you're experiencing issues with the Syncfusion Reporting Platform, Report Viewer, Report Designer, or Report Writer, we recommend migrating to Bold Reports, our dedicated reporting platform.

Bold Reports offers a comprehensive suite of tools and features for all your reporting needs, and we will help you make a smooth transition from the discontinued control. Our support team at https://support.boldreports.com/ is here to assist you with any questions or difficulties you may encounter during the migration process.

We thank you for choosing Syncfusion and appreciate your understanding.

RDL and Shared DataSources

Hi,
I just defined a RDL Report that has a connection to a shared DataSource(*.rds file).
I want to copy the file in the App_Data directory, eand change the connection when I am in  the Test environment and when I am in the Production environment.
There is a way to specify this other than the DataSourceCredentials?

    Thanks in advance

    Andrea Perazzolo


7 Replies

SR Soundara Rajan S Syncfusion Team June 29, 2015 11:09 AM UTC

Hi Andrea,

Thanks for using Syncfusion products.

I just defined a RDL Report that has a connection to a shared DataSource(*.rds file).
I want to copy the file in the App_Data directory, eand change the connection when I am in the Test environment and when I am in the Production environment.
You can modify/edit the report datasource or other section of report by accessing the report definition. You have to serialize the report and modify the desired property of the report definition, modified report definition need to be saved in to stream or file, before loading the report to ReportWriter/ReportViewer.
We have prepared a sample to modify the ReportDefinition dynamically and It can be downloaded from the following location.
http://www.syncfusion.com/downloads/support/forum/119473/ModifyDatasourceReference1670620741.zip

There is a way to specify this other than the DataSourceCredentials?

If we modify the datasource reference, then we have to provide the credential of the modify datasource as shown by below code snippet,

reportOption.ReportModel.DataSourceCredentials.Add(new DataSourceCredentials("NorthWindIO", "ssrs1", "RDLReport1"));



Please let us know, if you have any concerns.

Regards,
Soundara Rajan S.


AP Andrea Perazzolo June 30, 2015 12:45 PM UTC

Hi,
thanks for the answer.
So there is not a way to use a Shared Data Source that can be updated once when I put the application in production.
There is a way to pass to the ReportViewer the stream of the reportdefinition transformed or have I to write back a phisical file everytime I load a report.
In that case the best solution will be a procedure to change the reports one time when I publish them, but is risky if I forget a single one.
I was hoping in anything automatic to use.

     Thanks in advance

    Andrea Perazzolo


SR Soundara Rajan S Syncfusion Team July 1, 2015 11:10 PM UTC

Hi Andrea,

Thanks for your response.

So there is not a way to use a Shared Data Source that can be updated once when I put the application in production.
We could not modify the shared datasource used in report dynamically. If you need to modify shared datasource dynamically, then you have to edit the report definition.
There is a way to pass to the ReportViewer the stream of the reportdefinition transformed or have I to write back a phisical file everytime I load a report.
In that case the best solution will be a procedure to change the reports one time when I publish them, but is risky if I forget a single one.
I was hoping in anything automatic to use.
we have already exposed a Stream property in ReportViewerModel to load modified report stream in ReportViewer. Using this property, you can load modified report stream without saving into physical file, but we have some issues while assigning the report steam property and we have logged issue report on this. A support incident to track the status of this defect has been created under your account. Please log on to our support website to check for further updates

https://www.syncfusion.com/account/login?ReturnUrl=%2fsupport%2fdirecttrac%2fincidents

Please let us know, if you have any concerns.

Regards,
Soundara Rajan S.


AP Andrea Perazzolo July 2, 2015 06:38 AM UTC

Hi,
my question regarding the shared datasource is not how to change it, but how to use it when the report is not published in Report Server and loaded in the App_Data directory.
I have copied the file .rds in the same directory, but when I try to load the report in the reportviewer, there is an error in the rendering that says that cannot find datasource.
If it is possible to use it, could you provide me a working example?

    Thanks in advance

    Andrea Perazzolo


SR Soundara Rajan S Syncfusion Team July 4, 2015 06:41 PM UTC

Hi Andrea,

Thanks for your response.

my question regarding the shared datasource is not how to change it, but how to use it when the report is not published in Report Server and loaded in the App_Data directory.
I have copied the file .rds in the same directory, but when I try to load the report in the reportviewer, there is an error in the rendering that says that cannot find datasource.
If it is possible to use it, could you provide me a working example?
We could not read the shared datasource information from local physical location through ReportViewer control, but we can able to read shared datasource from App_Data location and assign the shared datasource information to report datasource while loading the report. We have prepared sample based on this and it can be downloaded from below location,
http://www.syncfusion.com/downloads/support/forum/119473/ReportViewerDemo-1111710594.zip

Please let us know, if you have any concerns.

Regards,
Soundara Rajan S.


AP Andrea Perazzolo July 10, 2015 03:23 PM UTC

HI,
I installed the patch you provided, but I am not able to set the Report Definition using the Stream Property insted writing the new file as in your example.
Could you please provide me a working sample that shows how to do it correctly?

    Thanks in advance

    Andrea Perazzolo


SR Soundara Rajan S Syncfusion Team July 13, 2015 01:24 PM UTC

Hi Andrea,

Thanks for your response.

We have tested the issue with provided patch, but we are unable to reproduce this issue and it’s working fine in our end. We request to you ensure to set the stream property through ReportModel in WebAPI IReportController as shown by below code snippet,

public void OnInitReportOptions(ReportViewerOptions reportOption)

{

reportOption.ReportModel.Stream = this.SerializeReport(reportOption.ReportModel.ReportPath);

reportOption.ReportModel.ReportPath = null;

}


private Stream SerializeReport(string path)

{

Syncfusion.RDL.DOM.ReportDefinition reportDefinition = new Syncfusion.RDL.DOM.ReportDefinition();

FileInfo info = new FileInfo(path);

FileStream stream = new FileStream(info.FullName, FileMode.Open, FileAccess.Read, FileShare.Read);

XElement rdl = XElement.Load(XmlReader.Create(stream));

string Namespace = (from attribute in rdl.Attributes() where attribute.Name.LocalName == "xmlns" select attribute.Value).FirstOrDefault();

string Version = (Regex.IsMatch(Namespace, @"\d{4}") ? Regex.Match(Namespace, @"\d{4}").Value : string.Empty);

XmlSerializer xs = new XmlSerializer(typeof(Syncfusion.RDL.DOM.ReportDefinition), Namespace);

stream.Position = 0;

stream.Close();


using (StringReader reader = new StringReader(rdl.ToString()))

{

reportDefinition = (Syncfusion.RDL.DOM.ReportDefinition)xs.Deserialize(reader);

}


foreach (var datasource in reportDefinition.DataSources)

{


XmlDataDocument xmldoc = new XmlDataDocument();

FileStream _dsStream = new FileStream(new FileInfo(HttpContext.Current.Server.MapPath("~/App_Data/AdventureWorksAS2008R2.rds")).FullName, FileMode.Open, FileAccess.Read, FileShare.Read);

xmldoc.Load(_dsStream);

XmlNode _node = xmldoc.FirstChild.NextSibling;



//Here you can edit the connection properties of the DataSource.

if (!string.IsNullOrEmpty(datasource.DataSourceReference))

{

}

}

stream.Close();

return this.SaveReport(reportDefinition);

}



For your reference, we have prepared sample based on this and it can be downloaded from below location,
https://s3.amazonaws.com/files2.syncfusion.com/dtsupport/directtrac/140893/ReportViewerDemo1989580498.zip

If you still face any issues on this, then could you please share much more information on this?. It will helpful to analyze this issue and provided the solution earlier.

Please let us know, if you have any queries.

Regards,
Soundara Rajan S.

Loader.
Live Chat Icon For mobile
Up arrow icon