Good morning,
I would like to use the BAQ Report SortBy field (Fields!SortBy.Value, “BAQReportParameter”), to change the group on values for a row group in a RDL/SSRS report.
In my BAQ Report, there are 4 ways to sort, by Job, Part, Customer, or Date. I would like to reference these sorts when defining the group on expression. This is what I have tried in the group on expression:
=if((Fields!SortBy.Value, "BAQReportParameter") = "Sort By Customer",Fields!Customer_CustID.Value, if((Fields!SortBy.Value, "BAQReportParameter") = "Sort By Job Num",Fields!JobHead_JobNum.Value, if((Fields!SortBy.Value, "BAQReportParameter") = "Sort By Job Req Date",Fields!JobHead_ReqDueDate.Value, if((Fields!SortBy.Value, "BAQReportParameter") = "Sort By Part Num",Fields!JobHead_PartNum.Value, Fields!JobHead_JobNum.Value))))
To me this says: if the sort is by customer, then group by cust ID, otherwise if the sort is by job num, then group by job num, and so on. At the end if none of the sorts match, default to group on job num (which shouldn’t ever happen if I set it up right). In the end I want three levels of grouping, but I will settle for getting one level to work. Eventually, I want to group by the sort by field first, then job, then asm, then op.
When I try to upload the report with this expression, I get the error:
Error Detail
Description: The SSRS server returned the status code 500 (InternalServerError) with the following error text:
The Group expression for the grouping ‘JobHead_JobNum’ refers to the field ‘SortBy’. Report item expressions can only refer to fields within the current dataset scope or, if inside an aggregate, the specified dataset scope. Letters in the names of fields must use the correct case.
Program: Ice.Core.TaskBase.dll
Method: .ctor
Line Number: 32
Column Number: 11
When I first wrote the expression, it defaulted to using First(Fields!SortBy.Value, “BAQReportParameter”), which gave a similar error due to the aggregate. I removed the ‘first’ part, and then got the error above.
I am open to ideas!
Thanks!
Nate