Invalid value for parameter 'ParameterName' when the parameter is float and the value is 0 or negative whole number in .NET Core projects
Float report parameter = 0 or negative whole number is returned as int and an exception is thrown in the viewer. The issue is observed only in .NET Core projects.
3 comments
Thomas Schicker
Posted on:04 Jun 2021 16:37
I am getting the same issue with a cross-tab report that navigates to a child report on one of the cells and passes several of the current row values (one of which is a float) as parameters to a child report. The HTML viewer shows the main cross-tab report fine, but when I attempt to drill into the cross tab and navigate to a child report by clicking on one of the row cell values, I get the error listed above.
I turned on SHOW PARAMETERS AREA on the sub report and I could see my float value (which in this case was 10.0) to the expected parameter. If I manually changed the parameter value in the parameters area to something other than an integer (such as 10.1), the sub report then displayed correctly.
My work around was to pass the parameter as a "String" type and then before passing it into the DS stored procedure parameters, I recast it back to a Dbl (e.g. "=CDbl(parameters.{parameterName}.value)"
I hope this gets fixed to avoid making these workarounds.
Regards,
Tom
Douglas
Posted on:07 May 2021 18:53
Hi Adam,
I reported issue as work around I added a const called HACK when I set parameter..
I have the same issue except any whole number causes results in an invalid value.
I'm Using the reporting API and confirmed that even when a parameter value is a floating point type (Either System.Single or System.Double) that the exception is thrown. Unless the value has any decimal precision to it.
For example, create an empty report, then add 1 floating point parameter "Test" with a default value of 1.
In the API controller, I override one of the default actions to override the parameter value:
// Results in an invalid value exception public override IActionResult CreateInstance(string clientID, [FromBody] ClientReportSource reportSource) { reportSource.ParameterValues["Test"] = (float)10.0; }
// Does not throw an exception and everything works public override IActionResult CreateInstance(string clientID, [FromBody] ClientReportSource reportSource) { reportSource.ParameterValues["Test"] = (float)10.1; }