Dynamic Report Generation

Stimulsoft Reports.Silverlight discussion
Locked
jdempsey72
Posts: 2
Joined: Wed Mar 02, 2011 10:44 am
Location: USA

Dynamic Report Generation

Post by jdempsey72 »

I am in the process of evaluating your technology. It appears to be a really good fit, but I cannot seem to find an example of what I am trying to do. I want my end users to be able to design reports using the Silverlight report designer within our Silverlight application. The schema to be used will be dynamic (defined by the end user), so I need to be able to create a report defintion at runtime on the server, bind the dynamic schema then stream the report down to the Silverlight client and display it in the designer so the end users can design the report using the objects from the dynamic schema.
Here are some code snippets from my prototype application:

// ------------------------------------------
// ON THE SERVER (WCF SERVICE):
// ------------------------------------------

// CREATE NEW REPORT AND BIND SCHEMA
StiReport stiReport = new StiReport();
string appDir = Environment.CurrentDirectory;
DataSet data = new DataSet();
// THIS XSD FILE WILL BE DYNAMICALLY GENERATED, BUT I AM USING YOUR SAMPLE DEMO ONE FOR MY PROTOTYPE.
data.ReadXmlSchema(appDir + "\\Demo.xsd");
data.ReadXml(appDir + "\\Demo.xml");
data.DataSetName = "Demo";
stiReport.RegData(data);
stiReport.Dictionary.Synchronize();

// SAVE REPORT TO STREAM
using (MemoryStream ms = new MemoryStream())
{
stiReport.Save(ms);
ms.Position = 0;
StreamReader sr = new StreamReader(ms);
reportDefXml = sr.ReadToEnd();
}

// SEND reportDefXml TO SILVERLIGHT CLIENT
return reportDefXml;

// ------------------------------------------
// ON THE SILVERLIGHT CLIENT:
// ------------------------------------------
reportDefXml =

StiReport report = new StiReport();
report.LoadFromString(reportDefXml);
designer.Report = report;

When the Silverlight designer loads, the Dictionary in the designer is empty. I would expect to see the heirarchy of schema objects that were defined in Demo.xsd. Am I missing a step somewhere.
Any assistance with this would be greatly appreciated.
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Dynamic Report Generation

Post by Alex K. »

Hello,

As far as I understand you, probably, did not do the following:
Stimulsoft.Report.StiOptions.Silverlight.WCFService.UseWCFService = true;

Please see our sample, everything is done there in detail:
http://www.stimulsoft.com/Downloads/WCF ... s_v1.2.zip

Thank you.
Locked