on 05-18-2010 12:24 AM
Are there any examples of using C# objects as a report datasource? I've tried to follow the slightly outdated tutorial in the help docs, applied to my own project, but all I come up w/ is a blank report (except for static text fields). The primary problem is that the marked classes don't seem to show up in the field selector, only instantiated objects.
Here's a code snippet, if that helps - The list elements, which are inserted into the report in the details section, is correctly populated but nothing appears.
private void ConfigureCrystalReports()
{
// Create the list object on which to report
PopulateCRLstReqSlcts();
try
{
crRepDocthis = new ReportDocument();
crRepDocthis.Load(@"...\CrystalReportSMLTest.rpt");
crRepDocthis.SetDataSource(DataBridge.instanceDataBridge.LstReqSlcts);
crystalReportsViewer1.ViewerCore.ReportSource = crRepDocthis;
}
catch(Exception ex)
{
string strThis = "Viewer Load Failed " + ex.Message;
MessageBox.Show(strThis);
}
}
public void PopulateCRLstReqSlcts()
{
// Create a new LstReqSlcts object and initialize it
// Initialize requirement list
DataBridge.instanceDataBridge.FillReqSlcts(DataBridge.instanceDataBridge.GetAllReqSlct());
}
// and some of my objects....
public partial class DataBridge
{
// Items for the Requirement Selector list box
public class ReqSlct
{
public ReqSlct()
{
}
public ReqSlct(int nRSIDThis, string strRSNamThis)
{
this.ReqSlctID = nRSIDThis;
this.strReqSlctNam = strRSNamThis;
}
public int ReqSlctID { get; set; }
public string strReqSlctNam { get; set; }
public override string ToString()
{
return strReqSlctNam;
}
}
[CrystalDecisions.CrystalReports.Engine.CrystalComplexTypeExpansionLevels(3)]
public List<ReqSlct> LstReqSlcts { get; set; }
It sounds like you're trying to is report off of "object collections". Download the CR 2008 Developer Guide from the following link, and search for the term "object collection" (without quotes) and you will some info, including a tutorial, on how to report off of object collections.
http://help.sap.com/businessobject/product_guides/boexir31/en/crsdk_net_dg_12_en.chm
I hope this helps.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
83 | |
10 | |
10 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.