Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/reporting-services/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Reporting services SSRS将字符串格式化为逗号数字_Reporting Services - Fatal编程技术网

Reporting services SSRS将字符串格式化为逗号数字

Reporting services SSRS将字符串格式化为逗号数字,reporting-services,Reporting Services,我在SSR中的一个文件中有以下值: =CStr(Fields!Shipment_Weight.Value) + "#" 我这样做是因为我需要结尾的#(磅)标志。这现在不允许我将数字格式化为类似于1000的格式,它当前给了我1000。有没有办法在代码中添加逗号而不是在格式框中添加逗号,因为现在这是一个字符串?值都不同于1-100000000 谢谢 我发现答案如下: =CStr(FORMAT(Fields!Shipment_Weight.Value,"N0")) + "#" 这就是如何使用格式化

我在SSR中的一个文件中有以下值:

=CStr(Fields!Shipment_Weight.Value) + "#"
我这样做是因为我需要结尾的#(磅)标志。这现在不允许我将数字格式化为类似于1000的格式,它当前给了我1000。有没有办法在代码中添加逗号而不是在格式框中添加逗号,因为现在这是一个字符串?值都不同于1-100000000


谢谢

我发现答案如下:

=CStr(FORMAT(Fields!Shipment_Weight.Value,"N0")) + "#"

这就是如何使用格式化代码,而不必将其放入格式化属性框中。

我相信上述方法会奏效,我一直使用MSDN中的以下内容

=CSTR(FORMAT(Fields!Shipment_Weight.Value,"#,#")) & "#"

自SSRS 2008 R2起,这可以使用FormatNumber()完成,如下所示:

=FormatNumber(Sum(Fields!GrossSales.Value),0)
Intellisense显示了以下定义:

FormatNumber(
   Expression As Object,    
   Optional NumDigitsAfterDecimal as Int32,
   Optional IncludeLeadingDigit as TriState,
   Optional UseParensForNegativeNumbers as TriState,
   Optional GroupDigits as TriState
) As String
然后可以在末尾添加“#”:

=FormatNumber(Sum(Fields!GrossSales.Value),0) & "#"
在表达式编辑器中的“常用函数->文本”下也可用:

  • FormatCurrency()
  • FormatDateTime()
  • FormatPercent()