简体   繁体   English

SSRS表达式中的语法错误

[英]Syntax error in expression of SSRS

I have two datasets in my report and data is being displayed through a table. 我的报表中有两个数据集,并且数据正在通过表格显示。 When I give expression like below: 当我给出如下表达式时:

=Format(Fields!InvDt.Value, "dsRepSalesReport_tblPrintSalesReport","dd/MMMyyyy")

It says there is Syntax error. 它说有语法错误。 If I remove 如果我删除

dsRepSalesReport_tblPrintSalesReport
part, there is no error. 部分,没有错误。

1) Please advise how to wite the expression in format with aggregate expression. 1)请告诉我们如何使用聚合表达式来格式化表达式。

2) If I write expression without 2)如果我写的表达式没有

 dsRepSalesReport_tblPrintSalesReport dsRepSalesReport_tblPrintSalesReport 
part, my table repeats data and shows for all invoice. 部分,我的表格会重复数据并显示所有发票。 But when I add aggregate part, 但是当我添加合计部分时
 dsRepSalesReport_tblPrintSalesReport dsRepSalesReport_tblPrintSalesReport 
Table just shows one value several times. 表只是多次显示一个值。

Please advise how to handel with these two issues. 请告知如何处理这两个问题。 Thanks 谢谢

The method signature for Format is: Format的方法签名为:

Public Shared Function Format(
   ByVal Expression As Object,
   Optional ByVal Style As String = ""
) As String

So that means you can't just specify the field and the Scope as in your first example; 因此,这意味着您不能像第一个示例中那样仅指定字段和范围。 the first of the two arguments must return one value only. 这两个参数中的第一个必须仅返回一个值。

In your example, you could use something like: 在您的示例中,您可以使用类似以下的内容:

=Format(First(Fields!InvDt.Value, "dsRepSalesReport_tblPrintSalesReport"), "dd/MMMyyyy")

Which will format the first value in the specified Scope. 它将格式化指定范围中的第一个值。

Another option would be to just set the value as required in the report then use the Format property: 另一个选择是仅根据报告中的要求设置值,然后使用Format属性:

在此处输入图片说明

It's difficult to answer your second question without knowing what your data/required results are... If you update the question with some simplified sample data to illustrate the actual issue you're facing that would be helpful. 不知道您的数据/所需结果是什么,很难回答第二个问题。如果您使用一些简化的示例数据来更新问题以说明您所面临的实际问题,那将是有帮助的。

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

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