Extending Report Designer with user function

2 posts, 0 answers
  1. Michele
    Michele avatar
    5 posts
    Member since:
    Jan 2014

    Posted 06 Jun 2014 Link to this post

    I'm having trouble extending Report Designer with User Function.

    I've created an assembly with 3 functions the following code:

    using System;
    using Telerik.Reporting.Expressions;

    namespace ReportLib
        public static class SVFunctions
            [Function(Category = "My Functions", Namespace = "ReportLib", Description = "Duration")]

            public static string Duration(DateTime Start, DateTime End)
                TimeSpan ts = End- Start;
                double Ore = ts.TotalHours;
                double Minuti = ts.TotalMinutes - (Ore*60);
                double Secondi = ts.TotalSeconds - (Ore*60) - (Minuti*60);
                return string.Format("{0:0}:{1:0}:{2:0}", Ore, Minuti, Secondi);


            [Function(Category = "My Functions", Namespace = "ReportLib", Description = "ToLocalTime")]
            public static DateTime ToLocalTime(DateTime utc)
                return utc.ToLocalTime();

            [Function(Category = "My Functions", Namespace = "ReportLib", Description = "Adesso")]
            public static string Adesso()
                return "12/12/2014";

    I've added the reference of the assembly inside the ReportDesigner config file.

             <add name="ReportLib" version="" />

    I've created a report and with a text field using an expression that references to the function Adesso() as you can see in to the attached picture.

    When I run the report I've the following error (shown into the picture)
    An error was occurred while processing TexBox 'xxx'. The Expression contains object 'ReportLib' that is not defined in the current context.

    What's I'm doing wrong


  2. Peter
    Peter avatar
    1611 posts

    Posted 09 Jun 2014 Link to this post

    Hi Michele,

    Please check out the Deploying trdx (XML report definition) that uses external assembly KB article, that elaborates on the required configuration.


    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

  3. DevCraft R3 2016 release webinar banner
Back to Top