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

Formula field function

7 Answers 712 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Molivia Sa
Top achievements
Rank 1
Molivia Sa asked on 31 Jan 2010, 10:29 PM
Dear telerik team,

I was wondering if in telerik reporting they have a function field or formula field that can be re use in the texbox for many times. its like the crystal report formula fields.

Thank you

7 Answers, 1 is accepted

Sort by
0
Steve
Telerik team
answered on 01 Feb 2010, 12:31 PM
Hello Molivia Sa,

We do not have specific "formula fields" available like in Crystal. However you can handle your field value calculation in an user function in your favorite programming language. Then you can use the function in the report designer like so: = MyUserFunction(Fields.MyField).

Kind regards,
Steve
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
devesh
Top achievements
Rank 1
answered on 02 Jun 2011, 07:38 PM
How can we pass multiple values using c# for    in    operator of filters of Telerik Reports?
Example :

=Fields.CustomerId    in    (1, 6, 7, 88, 22)

Thanks
0
Steve
Telerik team
answered on 03 Jun 2011, 01:22 PM
Hello devesh,

We've answered your inquiry in the other forum thread you have opened, please review our answer there for more information.

All the best,
Steve
the Telerik team
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 Public Issue Tracking system and vote to affect the priority of the items
0
siegfried
Top achievements
Rank 1
answered on 02 Aug 2019, 12:18 PM
Just a remark if I can : when you notice the answer is "somewhere else", could you remind the link, would be very useful for other users, as I myself look this information, and turning around for already an hour...

Thanks
0
Silviya
Telerik team
answered on 07 Aug 2019, 07:10 AM

Hi Siegfried,

I agree. Please let me post the answer from my colleague in the other post here as well:

"Currently our expressions don't support the required syntax. However, you can achieve the same result with a simple user function:

public static object[] SplitArray(string values)
{
    return values.Split(',');
}

Then you can use the above user function in the reports expressions as shown in the following sample:

Expression: =Fields.CustomerID 
Operator: In
Value: =SplitArray("1, 6, 7, 88, 22")

"

Regards, Silviya
Progress 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
Joshua
Top achievements
Rank 2
Iron
Veteran
Iron
answered on 09 Feb 2023, 03:50 PM
Do functions have to be in an assembly or can they be embedded in the report? We do not have the ability to use an external assembly, because of system constraints.
Dimitar
Telerik team
commented on 14 Feb 2023, 10:14 AM

If TRDP/TRDX report files are used, yes, the functions have to be in a separate assembly. However, if you are working with .NET CS report definitions, the custom functions can be part of the report library project which means that you will not need a separate assembly for them, the reports and the functions will be part of the same assembly produced from the report library project.

For example:

namespace MyReports
{
    using System;
    using Telerik.Reporting;

    /// <summary>
    /// Summary description for Report1.
    /// </summary>
    public partial class Report1 : Telerik.Reporting.Report
    {
        public Report1()
           {
                  InitializeComponent();
            }

        public static string SayHello()
           {
                  return "Hello";
           }

    }
}

Though it will be better to have the functions in a separate utility class. Then functions are called like Namespace.Class.FunctionName, for example, with the above code would be = MyReports.Report1.SayHello().

For information on the differences between the TRDP, TRDX, and .NET CS report definitions, you may refer to the Report Designer Tools Overview - Telerik Reporting article.

Joshua
Top achievements
Rank 2
Iron
Veteran
Iron
commented on 15 Feb 2023, 02:43 PM

That is what I was afraid of. I guess users will still be able to submit basic trdp/trdx files, but they won't be able to use custom functions, which really limits what you can do in the reports. However I cannot trust code that is submitted in an assembly from a 3rd party to be run inside of our app. Perhaps I can isolate it inside of its own appdomain.
Dimitar
Telerik team
commented on 17 Feb 2023, 11:37 AM

Thank you for sharing what is the scenario!

May I ask, what kind of user functions do you have, and what do they do? We could consider extending the built-in functions if a lot of people needed that functionality, you may even open a feature request with what functions you would like to see implemented out of the box - Progress® Telerik® Reporting Feedback Portal.

0
Joshua
Top achievements
Rank 2
Iron
Veteran
Iron
answered on 05 Apr 2023, 09:27 PM

Data sources have the ability to create calculated fields. Those fields can be re-used as formulas up the chain. This provided the layer of re-usability that I needed for formulas.

 

Tags
General Discussions
Asked by
Molivia Sa
Top achievements
Rank 1
Answers by
Steve
Telerik team
devesh
Top achievements
Rank 1
siegfried
Top achievements
Rank 1
Silviya
Telerik team
Joshua
Top achievements
Rank 2
Iron
Veteran
Iron
Share this question
or