Registering function in Report Designer 2020.3.2

Stimulsoft Reports.NET discussion
Post Reply
semaphore
Posts: 19
Joined: Fri Jul 24, 2020 12:53 pm

Registering function in Report Designer 2020.3.2

Post by semaphore »

Good Day,

Please could I get some guidance on how to embed custom functions within a report used in the designer (winforms), I have looked online and all videos seem to reference very old versions of this particular designer.
Lech Kulikowski
Posts: 6247
Joined: Tue Mar 20, 2018 5:34 am

Re: Registering function in Report Designer 2020.3.2

Post by Lech Kulikowski »

Hello,

Please check the following code:

Code: Select all

public class MyFunction
{
    private const string Category = "MyFuncCategory";


    public static string MyFunc(string value)
    {
        return value.ToUpper();
    }


    public static void RegisterFunctions()
    {
        var ParamNames = new string[1];
        var ParamTypes = new Type[1];
        var ParamDescriptions = new string[1];


        ParamNames[0] = "value";
        ParamDescriptions[0] = "Descriptions";
        ParamTypes[0] = typeof(string);


        Stimulsoft.Report.Dictionary.StiFunctions.AddFunction(Category, "MyFunc", "MyFunc", "Description", typeof(MyFunction),
                                 typeof(string), "Return Description", ParamTypes, ParamNames, ParamDescriptions);
    }
}
Thank you.
semaphore
Posts: 19
Joined: Fri Jul 24, 2020 12:53 pm

Re: Registering function in Report Designer 2020.3.2

Post by semaphore »

Thanks, the code was not the issue, the designer was, the UI is not intuitive at all and the functionality to add code is hidden in layers upon layers of settings. In any event, I eventually found it.
Lech Kulikowski
Posts: 6247
Joined: Tue Mar 20, 2018 5:34 am

Re: Registering function in Report Designer 2020.3.2

Post by Lech Kulikowski »

Hello,

Ok.

Thank you.
Post Reply