How to Keep bindings after changing Report

5 posts, 0 answers
  1. Kourosh
    Kourosh avatar
    3 posts
    Member since:
    Oct 2018

    Posted 24 Dec 2018 Link to this post

    Hello Telerik,

    I have a WPF application with Prism. I want to have reporting, so that users are able to change the default reports as they want.

    What I have done so far is:

    1) Created a Report inside the Visual Studio designer, filled it simply with an ObjectDataSource, which calls a method inside a ViewModel, which returns a list, bounded to report's fields.

    2) I convert the default report into a .trdp file, using reportPackager, which user can open and change with the "Standalone Report Designer".

    3) I unpack the .trdp file.

    So far so good.

    What happens now when I try to read the modified/changed version of the first report, is that I get the following error in my app:

     

    An error has occurred while processing Report 'Reportx':

    The assembly "xxx, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" is not permitted to be used by an ObjectDataSource component. Please include it in an AssemblyReferences element in the Telerik.Reporting configuration section of your application configuration file.

    What am I doing wrong? How can I keep bindings after changing the report with  Standalone Report Designer?

    I appreciate if you point me to right direction.

    Thank you.

    Kourosh

  2. Todor
    Admin
    Todor avatar
    333 posts

    Posted 28 Dec 2018 Link to this post

    Hi Kourosh,

    I assume that the initial (i.e. Visual Studio version) of the report is in the same assembly as the WPF application, hence it has not been necessary to register the ObjectDataSource data provider in the application configuration file - check ObjectDataSource configuration.
    Since the report has been converted to .TRDP file, it has become external for the WPF application that is using it and it will be necessary to register it as stated by the error message and as explained in the above article section.

    Regards,
    Todor
    Progress Telerik
    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
  3. Kourosh
    Kourosh avatar
    3 posts
    Member since:
    Oct 2018

    Posted 29 Dec 2018 in reply to Todor Link to this post

    Hello Todor,

    Happy new year and thank you so much for your reply.

    First of all answering to your question: yes, I checked visual studio designer and standalone versions, they have the same.

    My problem is that when I open the packed file (C# object to .trdp file) in standalone designer, ObjectDataSource is gone! 
    I am filling my ObjectDataSource's datasource as a list! 
    Can this be the problem?
    Report works fine in visual studio designer, but no ObjectDataSource in Standalone designer!

    I have succeeded (kind of) to do what I want actually by adding a new ObjectDataSource to my report instance before I pack it 
    and use calculated fields as workaround with unique names (same as my entity fields but they begin with _).

    When I unpack the file, I rebound the report (actually this part I am not 100% sure yet)!

    What am I doing wrong? Why report is losing track of ObjectDataSource, after it is filled?

    Is there any working example on this? ie how to pack report with ObjectDataSource and then unpack it back to program?

    Thank you again
    Kourosh

    Hello Todor,

    Happy new year and thank you so much for your reply.

    I have succeeded (kind of) to do what I want actually, but it seems that there is something that I am doing wrong!

    I checked visual studio designer and standalone, they have the same version.

    The problem is that when I open the packed file (C# object to .trdp file) in standalone designer, ObjectDataSource is gone! Reports data source is a only a list. It works fine in visual studio designer.

    I add a new ObjectDataSource to my report instance and use calculated fields as workaround with new names (they begin with _).

    When I unpack the file, I rebound the report (actually this part I am not sure yet)!

    What am I doing wrong?

    Is there any working example on this? ie how to pack report with ObjectDataSource and then unpack it back to program?

     

  4. Kourosh
    Kourosh avatar
    3 posts
    Member since:
    Oct 2018

    Posted 29 Dec 2018 in reply to Kourosh Link to this post

    I do apologize!

    My previous post became repetitive and unnecessarily long!

    Please feel free to delete after Kourosh.

    Thanks

  5. Todor
    Admin
    Todor avatar
    333 posts

    Posted 02 Jan Link to this post

    Hello Kourosh,

    The ObjectDataSource component can be used in both VS and Standalone Designer reports. The DataSource and DataMember properties are used design time and run time to invoke the data providing logic. For the purpose we use System.Reflection. The relevant information that is held in the Report definition is the Assembly Qualified Name of the DataSource (class to be instantiated) and the DataMember (method to be invoked to provide the data).
    The following snippet demonstrates how an ObjectDataSource component is represented in a trdx/p report definition :

    <ObjectDataSource DataMember="GetData" Name="objectDataSource1">
      <DataSource>
        <ClrType FullName="MyObjectDataSource.DataProvider" Assembly="MyObjectDataSource, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
      </DataSource>
    </ObjectDataSource>

    Note that for security reasons the ObjectDataSource can resolve only types that are declared either in the current report's assembly or in AssemblyReferences element nodes in Telerik.Reporting section of application configuration file.
    The error from the initial post states that the 'DataSource assembly should be included in an AssemblyReferences element in the Telerik.Reporting configuration section of your application configuration file'.
    For objectDataSource1 above the code in the application configuration file should look like :

    <Telerik.Reporting>
        <assemblyReferences>
            <add name="MyObjectDataSource" />
        </assemblyReferences>
    </Telerik.Reporting>

    The assembly MyObjectDataSource.dll should be added to the folder where the Standalone Report Designer resides. The configuration file of the Standalone designer is Telerik.ReportDesigner.exe.config and is in the same folder with the designer - (Telerik Reporting installation folder)\Report Designer (e.g. C:\Program Files (x86)\Progress\Telerik Reporting R3 2018\Report Designer).

    It is necessary to add this reference in the Standalone designer config file and to copy the assembly besides the designer to be able to preview the report there.

    Regards,
    Todor
    Progress Telerik
    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