The data is not visualized in WPF ReportViewer

6 posts, 0 answers
  1. Sergey
    Sergey avatar
    58 posts
    Member since:
    Jan 2013

    Posted 23 Aug Link to this post

    Hello, after I have updated WPF Controls and Telerik.Reporting libraries from Q2 2014 to Q1 2016 (WPF NoXAML 2016 Q1), I can't see any data in my reports (except table headers). But there are some errors in output window:

    *** ProcessReport #0 STARTED ***
    Exception thrown: 'System.OperationCanceledException' in mscorlib.dll
    Exception thrown: 'System.OperationCanceledException' in Telerik.Reporting.dll
    Exception thrown: 'System.OperationCanceledException' in Telerik.Reporting.dll
    *** ProcessReport #0 DONE in 00:00:00.1307766 ***

    In my code I do something like this:

    var reportSource = new InstanceReportSource {ReportDocument = rep};
    reportview.ReportSource = reportSource;
    reportview.RefreshReport();

     

    Please help me to solve this problem! Thanks

  2. Sergey
    Sergey avatar
    58 posts
    Member since:
    Jan 2013

    Posted 23 Aug Link to this post

    For dataSource I use next class with abstract ReportDataItem:

        public class ReportDataSet : OlbExternalObject
        {
            public string DataMember { get; set; }
            public List< ReportDataItem> DataItems { get; set; }


            [DataObjectMethod(DataObjectMethodType.Select)]
            public List<DealOwnReportRow> GetDealOwnDataItems()
            {
                return DataItems.ConvertAll(ItemToReportDealOwnDataItem);
            }

     

            [DataObjectMethod(DataObjectMethodType.Select)]
            public List<OrderReportRow> GetOrderDataItem()
            {
                return DataItems.ConvertAll(ItemToReportOrderDataItem);
            }


            private static OrderReportRow ItemToReportOrderDataItem(ReportDataItem item)
            {
                return item as OrderReportRow;
            }

            private static OrderReportRow ItemToReportOrderDataItem(ReportDataItem item)
            {
                return item as OrderReportRow;
            }

    }

     

    When I bind that object to report table I use ObjectDataSource

    var ods = new ObjectDataSource
                        {
                            DataSource = dataset,
                            DataMember = dataset.DataMember // "GetDealOwnDataItems"
                        };

    ((DataItem) dataItem).DataSource = ods;

    It had worked before I upgraded controls version, but now I have empty report table. But if I change my generic code to 

    ((DataItem) dataItem).DataSource = dataset.GetDealOwnDataItems()

    it will work!

    Is it possible to use generic solution (as I wrote) now? How can I fix my problem?

  3. DevCraft banner
  4. Sergey
    Sergey avatar
    58 posts
    Member since:
    Jan 2013

    Posted 23 Aug Link to this post

    For dataSource I use next class with abstract ReportDataItem:

        public class ReportDataSet : OlbExternalObject
        {
            public string DataMember { get; set; }
            public List< ReportDataItem> DataItems { get; set; }


            [DataObjectMethod(DataObjectMethodType.Select)]
            public List<DealOwnReportRow> GetDealOwnDataItems()
            {
                return DataItems.ConvertAll(ItemToReportDealOwnDataItem);
            }

     

            [DataObjectMethod(DataObjectMethodType.Select)]
            public List<OrderReportRow> GetOrderDataItem()
            {
                return DataItems.ConvertAll(ItemToReportOrderDataItem);
            }


            private static OrderReportRow ItemToReportOrderDataItem(ReportDataItem item)
            {
                return item as OrderReportRow;
            }

            private static OrderReportRow ItemToReportOrderDataItem(ReportDataItem item)
            {
                return item as OrderReportRow;
            }

    }

     

    When I bind that object to report table I use ObjectDataSource

    var ods = new ObjectDataSource
                        {
                            DataSource = dataset,
                            DataMember = dataset.DataMember // "GetDealOwnDataItems"
                        };

    ((DataItem) dataItem).DataSource = ods;

    It had worked before I upgraded controls version, but now I have empty report table. But if I change my generic code to 

    ((DataItem) dataItem).DataSource = dataset.GetDealOwnDataItems()

    it will work!

    Is it possible to use generic solution (as I wrote) now? How can I fix my problem?

  5. Sergey
    Sergey avatar
    58 posts
    Member since:
    Jan 2013

    Posted 23 Aug Link to this post

    I think problem is here 

    var ods = new ObjectDataSource
                        {
                            DataSource = dataset,
                            DataMember = dataset.DataMember // "GetDealOwnDataItems"
                        };

    Now it's impossible to set object as DataSource (only Type), is it correct? Have it changed since 2014 Q1 ?

  6. Sergey
    Sergey avatar
    58 posts
    Member since:
    Jan 2013

    Posted 23 Aug in reply to Sergey Link to this post

    I think problem is here 

    var ods = new ObjectDataSource
                        {
                            DataSource = dataset,
                            DataMember = dataset.DataMember // "GetDealOwnDataItems"
                        };

    Now it's impossible to set object as DataSource (only Type), is it correct? Have it changed since 2014 Q1 ?

  7. Stef
    Admin
    Stef avatar
    3036 posts

    Posted 26 Aug Link to this post

    Hello Sergey,

    Please test to upgrade to the latest Telerik Reporting version, where the ObjectyDataSource will execute the data-retrieval method of the specified as ObjectDatasource.DataSource data object.

    Installing Telerik Reporting


    In general, the purpose of the ObjectDataSource component is to provide data to the report in a declarative manner. The ObjectDataSource.DataSource should be the assembly qualified name or Type of the data access layer (class), where the reporting engine will use System.Reflection to create the instance of the class (by using the its default constructor) and to execute the method specified by the ObjectDataSource.DataMember property.

    Already instantiated data objects can be set directly as a data item's DataSource, without being wrapped in a data source component.


    I hope this helps.


    Regards,
    Stef
    Telerik by Progress
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top
DevCraft banner