An action error exists after adding a custom function to the report file.
Development Environment: Net Core 2.0 MVC
Report Version : 2018.3.3 (Stimulsoft.Reports.Web.NetCore Ver. 2018.3.3)
I want to print the number format in the format I want..
(ex: 2500.12345 => 2,500.12345, 2500 => 2,500)
I searched the forums about how to add user-defined functions.
"Register a custom function in a report" => viewtopic.php?f=13&t=52471
I have tested the sample report file in the search results.
Designer screen: 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.RemoveFunction("MyFunc");
Stimulsoft.Report.Dictionary.StiFunctions.AddFunction(Category, "MyFunc", "MyFunc", "Description", typeof(MyFunction),
typeof(string), "Return Description", ParamTypes, ParamNames, ParamDescriptions);
}
}
public class Report : Stimulsoft.Report.StiReport
{
public Report() {
this.InitializeComponent();
MyFunction.RegisterFunctions();
}
....
....
}
However, in the development environment, the output is not normal.
Controller:
Code: Select all
public IActionResult GetReport()
{
StiReport report = new StiReport();
var path = StiNetCoreHelper.MapPath(this, "Reports/ReportC.mrt");
report.Load(path);
return StiNetCoreViewer.GetReportResult(this, report);
}
I need help.