简体   繁体   English

SSRS 2008R2 #Error的自定义值

[英]SSRS 2008R2 Custom value for #Error

SSRS 2008R2 Custom value for #Error The attached picture is the output of my SSRS 2008R2 report. SSRS 2008R2 #Error的自定义值所附图片是我的SSRS 2008R2报告的输出。 I want to change the #Error to “ON Target”. 我想将#Error更改为“ ON Target”。 I have used different functions without luck. 我没有运气就使用了不同的功能。 The code I used is THE QUESTION IS IF Percentage>= 0.92 THEN RETURN "ON TARGET" ELSE RETUN Grand_Total-Under_2_months 我使用的代码是“如果百分比> = 0.92,则返回问题”,然后返回“按目标”,否则退还Grand_Total-Under_2_months

 =iif(ReportItems!Year.value>=0.92,"On Target",ReportItems!Textbox12.value-ReportItems!Under18Total.value)

在此处输入图片说明 This produce the attached report for TARGET TO MEET Column. 这将为“达到目标”列生成附件报告。 Can someone help to return the custom code (“ON Target”.) 有人可以帮助您返回自定义代码(“目标”)。

THIS IS THE DATA THAT GENERATED THE REPORT 这是生成报告的数据

DECLARE @Types TABLE
([Type] VARCHAR(20),    Under_2_months INT, Over_2_months INT,  Grand_Total INT,    Percentage DECIMAL(10,4))
INSERT INTO @Types VALUES
('Types1',  '1401', '969',  '2370', '0.591139240506329'),
('Types2',  '23487',    '1942', '25429',    '0.92363050060954'),
('Grand Total', '24888',    '2911', '27799',    '0.895284003021691')
SELECT * FROM @Types

You can't change the error value. 您无法更改错误值。 This is thrown by the compiler, in my experience it is usually a math related issue such as trying to divide by zero. 这是由编译器抛出的,以我的经验,这通常是与数学相关的问题,例如试图除以零。 Some in the comments also mentioned it might be a data type mismatch. 评论中的某些内容还提到这可能是数据类型不匹配。

I've attempted to detect #Error in the ReportItem and hide it but that doesn't work either. 我试图在ReportItem中检测到#Error并将其隐藏,但这也不起作用。 Your best bet is to fix your code so it doesn't error. 最好的选择是修复代码,以免出错。

Check that the data type for your "Target to Meet" textbox is not set to numeric. 检查“满足目标”文本框的数据类型未设置为数字。 If that's not the problem, break your IIF down to the basics and build it back bit by bit until it throws the error and you can identify what the problem code is. 如果这不是问题,请分解IIF的基础知识,然后一点一点地重新构建它,直到引发错误,您就可以确定问题代码是什么。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM