Furqan Sehgal
Furqan Sehgal

Reputation: 4997

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.

2) If I write expression without

dsRepSalesReport_tblPrintSalesReport
part, my table repeats data and shows for all invoice. But when I add aggregate part,
dsRepSalesReport_tblPrintSalesReport
Table just shows one value several times.

Please advise how to handel with these two issues. Thanks

Upvotes: 0

Views: 263

Answers (1)

Ian Preston
Ian Preston

Reputation: 39566

The method signature for Format is:

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:

enter image description here

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.

Upvotes: 1

Related Questions