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

How to use custom user functions in a web site project?

4 Answers 243 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Fridli Jacober
Top achievements
Rank 1
Fridli Jacober asked on 06 Oct 2015, 10:04 AM

Hello together 

Recently, we switched to the HTML 5 report viewer and XML reports which are part of a web site project. Now I wanted to use a custom user function to get a list of recursive nodes for use in an SQL query.
Now, how to access this function inside our web site? I guess, since the reports / report viewer are running inside the web site project, this should be possible?
In which scope is the report / report viewer / report processor running?

When I try to access a function from a separate assembly, this is working. But then I'm unable to access the classes from the web site which are representing the node hierarchy to use.

Thanks for any advice on this!

4 Answers, 1 is accepted

Sort by
0
Stef
Telerik team
answered on 08 Oct 2015, 03:00 PM
Hi Fridli,

The data access layer must be built in a separate assembly which can extend report designer in order to design reports. On deploying the report the start project(with the Reporting REST service) must be extended to load that external assembly in a similar way as the designer. For more details check Previewing a report definition that uses an external assembly.

You can also set the data at run-time by getting the data items from the report's Items collection and modifying their DataSource properties.

Note that Web Site projects are not supported by Telerik Report Designers, and reports must be designed in a separate ClassLibrary or the Standalone Report Designer.


Regards,
Stef
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
0
Fridli Jacober
Top achievements
Rank 1
answered on 09 Oct 2015, 10:41 AM

Hi Stef

Is it impossible to access the scope from the website from a report?
This way I have to pass the whole filter list in a report parameter from the viewer page instead of calling the function inside of the report. And as I said, when using an external assembly I'm unable to access the data structure withing the website which holds the data for the filter list.

Regards

0
Stef
Telerik team
answered on 13 Oct 2015, 03:06 PM
Hello Fridli,

If data objects are modified based on users interaction, and this data is handled in pages' events, the recommended approach is to assign the data at run-time. For example:
//get a report instance
var report = new MyReport();
 
//set the report's data source
report.DataSource = GetData();
 
//set a nested data item's data source
(report.Items.Find("table1",true)[0] as Telerik.Reporting.Table).DataSource = GetTableData();


Objects from the web site will not be available for work with the ObjectDataSource. If there is a data access layer that can be used without limitations introduced by relation to the UI or the used technology, the DAL can be built in an external assembly extending both the report designers and the application - Previewing a report definition that uses an external assembly.

Regards,
Stef
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
0
Fridli Jacober
Top achievements
Rank 1
answered on 14 Oct 2015, 09:23 AM

Hi Stef

I'm still unsure if we understand each other completely but I got some good hints and advices from you.
And at least I could pass the filter list in a custom report resolver to a MultiValue report parameter but that's the same idea as passing the filter list as report parameter throught JavaScript object in the report viewer...

Regards

Tags
General Discussions
Asked by
Fridli Jacober
Top achievements
Rank 1
Answers by
Stef
Telerik team
Fridli Jacober
Top achievements
Rank 1
Share this question
or