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

.net functionality supported in expresion i.e (loop)

5 Answers 212 Views
Report Designer (standalone)
This is a migrated thread and some comments may be shown as answers.
IamSalik
Top achievements
Rank 1
IamSalik asked on 01 Jul 2015, 11:03 AM

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

Sort by
0
Nasko
Telerik team
answered on 01 Jul 2015, 03:18 PM
Hello Salik,

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
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
IamSalik
Top achievements
Rank 1
answered on 02 Jul 2015, 09:32 AM

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;
        }
        //...
    }
}

0
Nasko
Telerik team
answered on 02 Jul 2015, 11:59 AM
Hello Salik,

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
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
IamSalik
Top achievements
Rank 1
answered on 02 Jul 2015, 03:39 PM

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

0
Nasko
Telerik team
answered on 03 Jul 2015, 10:38 AM
Hello Salik,

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
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
Tags
Report Designer (standalone)
Asked by
IamSalik
Top achievements
Rank 1
Answers by
Nasko
Telerik team
IamSalik
Top achievements
Rank 1
Share this question
or