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

6 posts, 0 answers
  1. IamSalik
    IamSalik avatar
    12 posts
    Member since:
    Dec 2012

    Posted 01 Jul 2015 Link to this post

    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

  2. Nasko
    Admin
    Nasko avatar
    909 posts

    Posted 01 Jul 2015 Link to this post

    Hello Salik,

    It is possible to send a data field value to a user function, where you can use loops and other .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
  3. DevCraft banner
  4. IamSalik
    IamSalik avatar
    12 posts
    Member since:
    Dec 2012

    Posted 02 Jul 2015 Link to this post

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

  5. Nasko
    Admin
    Nasko avatar
    909 posts

    Posted 02 Jul 2015 Link to this post

    Hello Salik,

    Please review the The 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
  6. IamSalik
    IamSalik avatar
    12 posts
    Member since:
    Dec 2012

    Posted 02 Jul 2015 Link to this post

    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

  7. Nasko
    Admin
    Nasko avatar
    909 posts

    Posted 03 Jul 2015 Link to this post

    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
Back to Top
DevCraft banner