StrataFrame Forum

Using a Custom Field in XtraReports

http://forum.strataframe.net/Topic29277.aspx

By Terry Bottorff - 12/28/2010

I have a BO that has a custom field. That all works well but now I am trying to design a report using XtraReports from DevExpress and I want to use that custom field in the report. I don't know how to get the custom field on the report or how to make it show up on the report? 
I know this is not the DevExpress site but when I ask questions on their site they don't seem to understand BO's or I don't know how to ask the question there.
TIA.
By Terry Bottorff - 12/28/2010

Never Mind I figured it out. 
By Greg McGuffey - 12/28/2010

Glad you got it figured out...what was the issue (in case somebody else runs into a similar issue)?
By Terry Bottorff - 12/29/2010

OK I have added a dataset to my project which allows me to drag and drop fields to my reports but since this field is a custom field of one of my BO's it does not appear in the dataset. 

I added a calculated field to my report and set the following properties: Datasource = myDataSet, DataMember=myTableinDataSet and the Expression=[CustomFieldName]. Dropped it on the report.

Then in my code to run the report I do the following:
Dim ds As New DataSet
        ds.Tables.Add(Me.StockTempsBO1.CurrentDataTable)
        Dim ddate As Date
        ddate = Me.CalcDate.CurrentDate.ToLongDateString
Dim report As New StockthatFellThruReport
        report.XrLabelheading.Text = crodeoname
        report.XrLabelheading1.Text = "Stock That Fell Thru from Draw"
        report.XrLabelheading2.Text = cwhatevt
        report.XrLabelheading3.Text = ddate.ToString("D")
        report.DataSource = ds
        report.DataMember = Me.StockTempsBO1.TableName
        report.ShowPreview()
I am not sure it is sound code but it works great and does exactly what I want it too. Comments Welcome.