Page 1 of 1
Registering function in Report Designer 2020.3.2
Posted: Fri Jul 24, 2020 12:56 pm
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.
Re: Registering function in Report Designer 2020.3.2
Posted: Fri Jul 24, 2020 2:05 pm
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.
Re: Registering function in Report Designer 2020.3.2
Posted: Fri Jul 24, 2020 2:59 pm
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.
Re: Registering function in Report Designer 2020.3.2
Posted: Mon Jul 27, 2020 10:23 am
by Lech Kulikowski
Hello,
Ok.
Thank you.