I have a BAQ report that can be sorted in four ways. By Job Due date, by part number, by job number, or by customer. Each of these sorts come with a few layers of sorting. For example, if the user chooses the sort option for due date, then my expressions chooses the right sorting field.
Sort 1:
=if(Fields!ReportGroupSortBy.Value="Sort By Customer",Fields!Customer_CustID.Value, if(Fields!ReportGroupSortBy.Value="Sort By Job Num",Fields!JobHead_JobNum.Value, if(Fields!ReportGroupSortBy.Value="Sort By Job Req Date",Fields!JobHead_DueDate.Value, if(Fields!ReportGroupSortBy.Value="Sort By Part Num",Fields!JobHead_PartNum.Value, Fields!JobHead_JobNum.Value))))
Sort 2
=if(Fields!ReportGroupSortBy.Value="Sort By Customer",Fields!JobHead_JobNum.Value, if(Fields!ReportGroupSortBy.Value="Sort By Job Num",Fields!JobAsmbl_AssemblySeq.Value, if(Fields!ReportGroupSortBy.Value="Sort By Job Req Date",Fields!JobHead_JobNum.Value, if(Fields!ReportGroupSortBy.Value="Sort By Part Num",Fields!JobHead_JobNum.Value, Fields!JobAsmbl_AssemblySeq.Value))))
Sort 3
=if(Fields!ReportGroupSortBy.Value="Sort By Customer",Fields!JobAsmbl_AssemblySeq.Value, if(Fields!ReportGroupSortBy.Value="Sort By Job Num","", if(Fields!ReportGroupSortBy.Value="Sort By Job Req Date",Fields!JobAsmbl_AssemblySeq.Value, if(Fields!ReportGroupSortBy.Value="Sort By Part Num",Fields!JobAsmbl_AssemblySeq.Value, ""))))
I want to add an ID field for users to quickly identify a line when reviewing this report as a group. It is easier to say item 123, than part number 11238419233. I can make the BAQ calculate a dense rank, but that means I have to hard code in the sorting option (if I want the IDs to be sequential). This is the expression I use to create the dense rank in my BAQ:
DENSE_RANK() OVER (ORDER BY OldTop.JobHead_JobNum, OldTop.JobAsmbl_AssemblySeq)
I would like to apply this kind of expression at the report level, after the sort has been determined. I think that I would need different syntax, and report builder doesn’t like to use dense rank. Can anyone say if this is possible? I want to rank my report items based on the sort that gets selected at the BAQ report screen.
Thanks for your time!