Hello,
I have a field which have to be processed before being display, One way is to do it at backend in database while getting data. But that will be very difficult. Is it possible that i can process a field value in an expression or calculated field where i could use loop and other features of .net?
Regards
Salik
5 Answers, 1 is accepted
It is possible to send a data field value to a user function, where you can use loops and NET features. For more detailed information, please refer to the User Functions help article.
Regards,
Nasko
Telerik
Hello Nasko,
I have defined a user function and referenced it in expression. My class code is given below. In Expression i wrote
= MySol.Test("abc")
it says "MySol is not defined in current context", What settings do i have to set in web.config to define MySol in the report
namespace
MySol
{
public
class
TelerikUserFunctions : Telerik.Reporting.Report
{
//...
[Function(IsVisible =
true
, Category =
"User Functions"
, Namespace =
"MySol"
, Description =
"Test"
)]
public
static
string
Test(
string
prmStr)
{
return
"Hello, "
+ prmStr;
}
//...
}
}
Please review expression contains undefined function call MyUserFunction() error KB article for possible reasons for the issue.
Also, check if the user function shows up in the Misc section of the Edit Expression window: screenshot.
Regards,
Nasko
Telerik
Hello Nasko
I think i couldn't clear my question before so i am sending the details again.
I am using stand alone designer to create trdx reports with Html5 report viewer of telerik to view, and selecting report at runtime in CustomReportResolver in ReportsController of my MVC project. This is the whole scenario which is also given in the attached snapshots.
What i need is how to define a custom user function which can be used as an expression in this scenario. And what are the requirements.
Thanks
Regards
To use a user function inside a TRDX report displayed in the HTML5 Report Viewer you will need to add an assembly reference in the Telerik Reporting Configuration Section. The reference should point to the assembly where the user function resides. The assembly containing the user function should be referenced in the project.
How to add the Telerik Reporting Configuration Section to your web.config file is described here. A sample configuration section and assembly reference XML are shown in the following sample code:
<
configuration
>
<
configSections
>
<
section
name
=
"Telerik.Reporting"
type
=
"Telerik.Reporting.Configuration.ReportingConfigurationSection, Telerik.Reporting, Version=X.X.X.X, Culture=neutral, PublicKeyToken=a9d7983dfcc261be"
allowLocation
=
"true"
allowDefinition
=
"Everywhere"
/>
</
configSections
>
<
Telerik.Reporting
>
<
AssemblyReferences
>
<
add
name
=
"MyCustomAssembly"
version
=
"1.0.0.0"
culture
=
"neutral"
publicKeyToken
=
"null"
/>
</
AssemblyReferences
>
</
Telerik.Reporting
>
To enable design-time support for the user function (Standalone Report Designer), please follow the instructions in the Extending Report Designer help article.
Regards,
Nasko
Telerik