This is a migrated thread and some comments may be shown as answers.

Custom Report DataSource

7 Answers 454 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
NiccoMlt
Top achievements
Rank 1
Veteran
NiccoMlt asked on 31 Jul 2020, 08:21 AM

Hi,

I'm porting an old reporting system to Telerik, and I need to adapt the old data provider strategy to a Telerik DataSource that I can use with a Telerik Report.

None of the DataSources provided suit my needs, so I'm thinking about implementing my own extension of DataSource abstract class. I didn't find any suggestion about that in the documentation; is it possible?

 

Thanks in advance and best regards.

7 Answers, 1 is accepted

Sort by
0
Yana
Telerik team
answered on 04 Aug 2020, 02:51 PM

Hi NiccoMlt,

I am afraid there isn't a straightforward way to implement  a custom DataSource.  Although I am not familiar with the current data provider you have, I would suggest you consider using ObjectDataSource  component.

The ObjectDataSource component will invoke its DataMember (or its DataSource constructor) that should return the data (i.e. your Dictionary object or other custom object). The DataMember can receive parameters (e.g. ID) that can be set when configuring the ObjectDataSource component - check Using Parameters with the ObjectDataSource Component.

The set-up and usage of a ObjectDataSource component is demonstrated in the CSharp.ReportLibrary project in our examples -> ListBoundReport.cs in the DataBinding folder. The examples folder is (Telerik Reporting installation folder)\Examples\CSharp (e.g. C:\Program Files (x86)\Progress\Telerik Reporting <VERSION>\Examples\CSharp).

I hope this will help get started. Let me know if you have any additional questions.

Regards,
Yana
Progress Telerik

0
NiccoMlt
Top achievements
Rank 1
Veteran
answered on 05 Aug 2020, 01:20 PM

Hi Yana,

thank you for your answer.

Sadly, I discussed your alternative solution with my supervisor, but we came to the conclusion that it will not work the same for my use case.

Because of the way the data provider works, ObjectDataSource should invoke a custom object that handles the conversion from the dynamic buffer abstractions of the data provider to plain objects that Telerik can use via ObjectDataSource.

The problem with this solution is that it requires to create and load new asseblies for these new classes definitions via reflection; this introduces two major problems:

  1. it comes with a noticeable performance cost;
  2. for the way the .NET runtime works, the garbage collector will not be able to track those assemblies and unload them when they are not needed anymore, potentially leading to memory leaks.
0
Yana
Telerik team
answered on 06 Aug 2020, 12:24 PM

Hi NiccoMlt,

I understand ObjectDataSource is not suitable for the concrete use case.  

Still, could you elaborate a little bit more on the exact scenario you have at hand? In general, the Reporting data source components do not contain the data itself, they just provide means for retrieving the data needed for generating the report.

I look forward to your reply. 

Regards,
Yana
Progress Telerik

0
NiccoMlt
Top achievements
Rank 1
Veteran
answered on 06 Aug 2020, 12:41 PM

Hi, I'm not allowed to disclose every detail about the data provider, but I'll try to elaborate the problem without violating the policy of the company I work for.

The data provider is an old and optimized solution to retrive and elaborate data from a databare (which I am not allowed to bind directly to) and provide them via some sort of untyped memory buffers to an entity which visualize and print them.

My job is to replace this preview and print entity with a new one based on Telerik Reporting. The major problem in this task is to map the data generated by the data provider to something that can be bound to a Telerik DataSource.

I am aware that DataSources are not meant to contain data: if I were able to realize my own custom DataSource, I probably would have been able to bind the DataSource to the buffers used by my old data provider. But as far as I can tell from your previous answer, this is not possible.

Did I explain the problem better? Am I missing something?

0
Accepted
Yana
Telerik team
answered on 11 Aug 2020, 10:54 AM

Hello NiccoMlt,

Š¢hank you for describing the use case in details.  I discussed it with our dev team and actually it wouldn't be possible to implement a custom data source - this is due to the fact that our processing classes used to retrieve the data wouldn't be accessible in such a scenario.

I remain at your disposal if you have any additional questions.

Regards,
Yana
Progress Telerik

0
NiccoMlt
Top achievements
Rank 1
Veteran
answered on 11 Aug 2020, 03:23 PM

Hello Yana,

thank you for your help. Ok then, my team and I inspected the problem further and we came to the same conclusion.

I'll mark the thread as answered.

Best regards

0
GodHank
Top achievements
Rank 1
answered on 13 Aug 2020, 08:51 AM

Thank you all for your kindness to me, I wish you good health and good luck!

https://www.vipsitelife.com

Tags
General Discussions
Asked by
NiccoMlt
Top achievements
Rank 1
Veteran
Answers by
Yana
Telerik team
NiccoMlt
Top achievements
Rank 1
Veteran
GodHank
Top achievements
Rank 1
Share this question
or