cancel
Showing results for 
Search instead for 
Did you mean: 

CRVS2010 Beta - C# objects as DataSource

Former Member
0 Kudos

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; }

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

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.

Answers (0)