SQL Report Services 2005打印问题 [英] SQL Report Services 2005 print issue

查看:80
本文介绍了SQL Report Services 2005打印问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图将两个数据库字段(PinRadius1和PinRadius2,这些字段包含varchar数据)打印到标签上.如果其中一个字段为空(不包含任何数据),则无需打印该字段.如果该字段包含数据,则需要在数字的前面加上字符"X",并确保数字的位数也保留两位小数.这是我正在使用的表达式:

= FormatNumber(Fields!PinRadius1.Value,2)&Switch(Len(Trim(Fields!PinRadius2.Value))= 0,"Switch1:"&Len(Trim(Fields!PinRadius2.Value)),Len(Trim(Fields !PinRadius2.Value))> 0,"X"&FormatNumber(Fields!PinRadius2.Value,2))

如果PinRadius.Value字段为空,则会出现以下错误
"[rsRuntimeErrorInExpression]文本框'PinRadius1'的Value表达式包含错误:输入字符串的格式不正确."

如果删除FormatNumber命令,则没有错误.我相信这是一个格式化问题.我已经尝试过Google和Yahoo搜索,但是没有运气.你们中的任何一个都可以帮忙吗?
谢谢,

I am trying to print twodatabase fields (PinRadius1 and PinRadius2, fields contain varchar data)to a label. If one of the fields is empty (contains no data) I do not need to print that field. If that field contains data I need to put the character "X" in fornt of the number and make sure the number goes out too two decimal places. Here is the expression I am using:

=FormatNumber(Fields!PinRadius1.Value,2) & Switch(Len(Trim(Fields!PinRadius2.Value))= 0, "Switch1: " & Len(Trim(Fields!PinRadius2.Value)), Len(Trim(Fields!PinRadius2.Value))> 0, " X " & FormatNumber(Fields!PinRadius2.Value,2))

If the PinRadius.Value field is empty, I get the following error
"[rsRuntimeErrorInExpression] The Value expression for the textbox ‘PinRadius1’ contains an error: Input string was not in a correct format."

If I remove the FormatNumber command no error. I believe it is a formatting issue. I have tried Google and Yahoo search and no luck. Can any of you help???
thanks,

推荐答案

检查该字段是否为空.

Check if the field is empty.

iif(Fields!PinRadius2.IsMissing, true, false)



或尝试这个



or try this

iif(IsNothing(Fields!PinRadius2.Value), true, false)


这是我发现的有效方法


= FormatNumber(Fields!PinRadius1.Value,2)&
开关(
Isnothing(Fields!PinRadius2.Value),",
Len(Fields!PinRadius2.Value)> 0,Code.Formatvalue(Fields!PinRadius2.Value)
)


报表属性/代码
函数FormatValue(ByVal RadiusValue2作为字符串)作为String

将TMPRadius2调暗为String ="

如果不是IsNothing(RadiusValue2),则

如果Not RadiusValue2 ="然后

TMPRadius2 =格式(CDBL(RadiusValue2),#0.00")
TMPRadius2 ="X"; &TMPRadius2

其他

TMPRadius2 ="

如果结束

其他
TMPRadius2 ="
如果结束

返回TMPRadius2
Here is what I found works


=FormatNumber(Fields!PinRadius1.Value,2)&
switch (
Isnothing(Fields!PinRadius2.Value),"",
Len(Fields!PinRadius2.Value) >0, Code.Formatvalue(Fields!PinRadius2.Value)
)


Report Properties/Code
Function FormatValue (ByVal RadiusValue2 as String) as String

Dim TMPRadius2 as String = ""

If Not IsNothing (RadiusValue2) Then

If Not RadiusValue2 = "" Then

TMPRadius2 = Format(CDBL(RadiusValue2) ,"#0.00")
TMPRadius2 = " X "; & TMPRadius2

Else

TMPRadius2 = ""

End If

Else
TMPRadius2 = ""
End If

Return TMPRadius2


这篇关于SQL Report Services 2005打印问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆