How to use Floor/Ceiling in a ReportModel expression field?

自作多情 提交于 2019-12-02 18:07:58

问题


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));
}

I tried this:

IF(delta > 0, Ceiling(delta), Floor(delta))

But it seems that ReportModel expressions don't support the Ceiling or Floor functions. Is there a way to do this?

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.


回答1:


It is in fact supported. Use the following expression:

=IIF(delta > 0, ceiling(delta), floor(delta))



回答2:


If you cannot find an SSRS solution you can of course create a c# assembly and call it from your report!



来源:https://stackoverflow.com/questions/1589423/how-to-use-floor-ceiling-in-a-reportmodel-expression-field

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!