问题描述
我在 SSRS 2005 报告模型项目中工作.我想在 ReportModel 上创建一个与此 C# 方法相同的表达式字段:
I'm working in an SSRS 2005 Report Model Project. I want to create an expression field on a ReportModel that does the same as this C# method:
private static int GetClosestWholeNumberToward0(double delta)
{
return (int) (delta > 0 ? Math.Ceiling(delta) : Math.Floor(delta));
}
我试过了:
IF(delta > 0, Ceiling(delta), Floor(delta))
但似乎 ReportModel 表达式不支持 Ceiling 或 Floor 函数.有没有办法做到这一点?
But it seems that ReportModel expressions don't support the Ceiling or Floor functions. Is there a way to do this?
更新:由于不断变化的要求增加了此报告的复杂性,我将重新开始使用 Visual Studio 中的报告设计器.所以我应该能够在报告的表达式字段中使用 Math.Ceiling() 和 Math.Floor().
Update: Due to changing requirements that added additional complexity to this report, I'm going to start over with the Report Designer in Visual Studio. So I should be able to use the Math.Ceiling() and Math.Floor() in an expression field on the report.
推荐答案
实际上是支持的.使用以下表达式:
It is in fact supported. Use the following expression:
=IIF(delta > 0, ceiling(delta), floor(delta))
这篇关于如何在 ReportModel 表达式字段中使用地板/天花板?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!