Imported DLL report not fully working

4 posts, 0 answers
  1. TonyG
    TonyG avatar
    239 posts
    Member since:
    Feb 2006

    Posted 08 Apr 2013 Link to this post

    I have a DLL with a report. When I go from design mode to preview in VS the report constructor is executed and it does what's required.

    Using the stand-alone designer I import the DLL, and on initial creation the constructor is invoked - twice actually. But from then forward, it's never invoked on preview or at any other time.

    I created a Windows Form with a report viewer, set the ReportSource to the TRDX via a URL/file reference. Same thing - ODS is called but the report constructor is never invoked.

    I'm using the ODS only to retrieve design-time schema. At run-time I'm using report parameters to determine what data to return, and the ODS is invoked manually from NeedDataSource. Someone might think I need to set the ODS to null in the constructor. Again, the constructor is not being called.

    The stand-alone designer does show my class name "ReportTemplate" in the Property Browser. So I know it found that class. My report has the ODS pre-loaded, and when the designer first opens that ODS is there, obviously coming from execution of the InitializeConstructor() method, executed from my constructor. So On initial creation it finds what it needs in that class.

    From the report viewer, the interactive mode does display a text box that was placed for the header. So it seems InitializeComponent() is getting executed for that report, but nothing else. This is very confusing. It's almost like the report base class is getting executed but not my derived class - and once a report is imported, the derived class isn't invoked anymore. Or perhaps I just don't know what setting to check to get it to instantiate my report class at run-time. Maybe it's a namespace issue and at run-time it can't find my report class within my namespace.

    Side note: Originally the interactive mode did not display that report header, but going to preview mode it did. My ODS is returning a DataTable with columns defined and no rows. When I changed that to return a single row of null column data, interactive mode started to show the header too - it's like a null DataSource causes one mode to not render anything but it's different in the other mode. I dunno if anyone would call that a bug but it's certainly slightly anomalous behavior.

    Thanks.
  2. Milen
    Admin
    Milen avatar
    163 posts

    Posted 10 Apr 2013 Link to this post

    Hello Tony,

    The produced trdx report definition contains the property values of the instantiated report type that you have designed in Visual Studio. From that moment on, both have nothing in common. The trdx report does not have any .NET code. When deserialized in order to be shown in a viewer, an instance of the Telerik.Reporting.Report class in created and populated with the properties \ child items serialized in the file. That also means that no events will be available in the deserialized report. You may get a better understanding of what is and have your report after imported from dll by opening the trdx file using some text editor (notepad for example).

    If you need to programmatically modify the DataSource, based on parameters, you have two options:
    • ObjectDataSource - gives you full freedom to provide whatever data is needed based on parameters
    • Binding the DataSource property of the report (or other DataItem) to expression referring to user defined function that will return the actual data source - again you may pass parameters to the user function as needed.

    Both approaches will require extending the Stand-alone designer with code. See Extending Report Designer.
    Kind regards,
    Milen
    the Telerik team

    Have you tried the new visualization options in Telerik Reporting Q1 2013? You can get them from your account.

  3. DevCraft banner
  4. TonyG
    TonyG avatar
    239 posts
    Member since:
    Feb 2006

    Posted 10 Apr 2013 Link to this post

    I should have known that from the documentation but it sometimes takes a while to internalize these things.
    I already have my assembly registered in the config file via <Telerik.Reporting> <AssemblyReferences>.

    Here are the basic questions then:

    At run-time how do I access the Telerik.Reporting.Report and the Telerik.Reporting.Processing.Report?

    When the ODS is invoked does it have a reference to either of those in a serialized form?

    Do I need to read the TRDX and parse for the values I need? (I look for =Fields. references) Or can I serialize that into a Report object and then parse as I have been doing at design time?

    At run-time does the ODS even know the report ID that's getting processed so that I can do that?

    Can our AssemblyReference be invoked for anything other than the ODS or functions? I'm trying to understand just what can and can't be done. I was thinking it's like code-behind from ASPX but apparently it's much more separated.

    Where should I be going for blogs, videos, or documentation about exactly how the Report processing works from one stage to the next at run-time?  Teach a man to fish and ...

    Thanks!!

  5. Peter
    Admin
    Peter avatar
    1611 posts

    Posted 15 Apr 2013 Link to this post

    Hello,

    Generally you can access the Telerik.Reporting.Processing.Report and Telerik.Reporting.Report
    with the following expression:

    =ReportItem.Report
    =ReportItem.Report.ItemDefinition

    Generally we will appreciate if you elaborate further on your requirement to access the report objects.
    You can pass those report objects with the data retrieval member arguments because the datasource parameter values support expressions. Check out the ObjectDataSource Wizard help article.

    The easiest approach to access the report items is to deserialize the TRDX report definitions. For more information check out the Serializing Report Definition in XML help article.

    The AssemblyReference is used to add your own User Functions, User Aggregates or bind to custom CLR objects, data models (such as an OpenAccess ORM model), external assemblies with custom data source objects, data feeds (including OData), and web services. On this topic you may find useful the Extending Report Designer help article.

    About your last question more our suggestion is to review the Report Life Cycle help article.

    All the best,
    Peter
    the Telerik team

    Have you tried the new visualization options in Telerik Reporting Q1 2013? You can get them from your account.

Back to Top