Delaying loading of data

Stimulsoft Reports.NET discussion
jmiller
Posts: 91
Joined: Mon Sep 20, 2010 12:18 pm

Re: Delaying loading of data

Post by jmiller »

Sorry, here is the zip.
Attachments
StimulsoftBusinessObjectsTest.zip
Project file
(15.2 KiB) Downloaded 263 times
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Delaying loading of data

Post by HighAley »

Hello.

You can't get columns with report.Dictionary.GetDataSet("LoanData"); method if there is no data.
But you could create new dataset and register it with the same name.

Code: Select all

static public void LoadData(StiReport report)
{
   //MessageBox.Show("DataProvider called");

   if (report.CompiledReport != null)
      report = report.CompiledReport;

   //StiDataSource dataSrc = report.Dictionary.DataSources[0];

   //DataSet dataSet = report.Dictionary.GetDataSet("LoanData");

   DataSet dataSet = new DataSet("Test");
   dataSet.ReadXmlSchema("TestData.xsd");

   // This block attempted to add rows dynamically
   DataRow newRow1 = dataSet.Tables[0].NewRow();
   // An exception occurrs here because there are columns in datarow
   newRow1[0] = "ABC0001";
   newRow1[1] = new DateTime(2012, 3, 17);
   dataSet.Tables[0].Rows.Add(newRow1);

   DataRow newRow2 = dataSet.Tables[0].NewRow();
   newRow2[0] = "XYZ9876";
   newRow2[1] = new DateTime(1999, 5, 17);
   dataSet.Tables[0].Rows.Add(newRow2);

   dataSet.ReadXml("TestData.xml");
   report.RegData(dataSet);
   report.Dictionary.Synchronize();


   // I then tried to read data from an xml into the dataset
   // No data will appear when report is run or previewed
   dataSet.ReadXml("TestData.xml");

}
Thank you.
jmiller
Posts: 91
Joined: Mon Sep 20, 2010 12:18 pm

Re: Delaying loading of data

Post by jmiller »

Thanks, I will give it a try.

On a similar note, is there a method/event I can use to do the same thing when a user calls "View Data"?
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Delaying loading of data

Post by HighAley »

Hello.
jmiller wrote:On a similar note, is there a method/event I can use to do the same thing when a user calls "View Data"?
Unfortunately, there is no such event.

Thank you.
Post Reply