从文本转换为数字 - 从SQL Reporting Services 2008 r2导出到Excel 2003 [英] Convert from Text to Number - Exporting to Excel 2003 from SQL Reporting services 2008 r2

查看:117
本文介绍了从文本转换为数字 - 从SQL Reporting Services 2008 r2导出到Excel 2003的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




我试图导出一个浮动格式的报告。当我这样做时,excel中的所有数字旁边都有一个绿色的小标签,上面写着



此单元格中的数字被格式化为文本或以撇号开头 。



我必须总结我的报告值,这只能在我将每个单元格转换为数字后才能完成。报告本身有没有办法解决这个问题?



谢谢。

Hi
I was trying to export a report which is in float format. When I do that, all the numbers in excel have a green small tag beside it saying

"The number in this cell is formatted as text or preceeded by an apostrophe".

I have to sum my report values and this can only be done after I convert each cell to number. Is there any possible way to handle this in report itself ?

Thank You.

推荐答案

在这里,它已经在这里讨论和分享:此单元格中的数字被格式化为文本或以撇号开头。 [ ^ ]



它说:

要解决这个问题,我们可以设置:

= Fields!MyField。作为值的值和set =###,###,###,## 0作为格式。您可以在属性窗口的外观下找到格式。
Here, it has been discussed and shared here: "The number in this cell is formatted as text or preceeded by an apostrophe."[^]

It says:
To solve this problem we can set:
=Fields!MyField.Value as the Value and set ="###,###,###,##0″ as the Format. You can find the "Format" under the "Appearance" of the properties window.


您好,



问题可能是由于您尝试将非数字值转换为整数值。对于表达式,如果我们使用以下表达式:= CInt(ABC),我们将在报告中获得#Error值。



根本原因是IIF ()函数总是计算true部分和false部分,即使它只返回其中一个。这意味着需要评估真实部分和虚假部分。



请参考以下自定义代码解决此问题:



公共功能转换(ByVal A as String)

Dim B as string

Dim C as Integer

如果是数字(A)那么

C = CInt(A)

返回C

其他

B = CStr(A)

返回B

结束如果

结束功能





然后,我们可以使用下面的表达式来计算值:

= Code.Conv(Fields!PID.Value)





问候,

Vinoth Paramasivam
Hello,

The issue may be due to you tried to convert a nonnumeric value to an integral value. For expression, if we are use following expression: =CInt("ABC"), we would get the #Error value in our report.

The root cause is IIF() function always evaluates both the true part and the false part, even though it returns only one of them. This means both the true part and the false part need to be evaluate.

Please refer to the custom code below to work around the issue:

Public Function Conv(ByVal A as String)
Dim B as string
Dim C as Integer
If isnumeric(A) Then
C=CInt(A)
Return C
else
B=CStr(A)
Return B
End If
End Function


Then, we can use the following expression to calculate the value:
=Code.Conv(Fields!PID.Value)


Regards,
Vinoth Paramasivam


这篇关于从文本转换为数字 - 从SQL Reporting Services 2008 r2导出到Excel 2003的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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