Search code examples
reporting-servicesssrs-2008ssrs-2008-r2ssrs-2012alphanumeric

Stop alphanumeric force sort for subreport in SSRS


I have a subreport that prints out a shipping label in SSRS. It takes an Order # as a parameter. I have another report that allows for multiple orders to be entered in as one parameter (separated by commas) and then using this

=Split(UCase(Parameters!OrderNo.Value), ",")

runs through each of the order #s in the parameter string and churns out the subreport (shipping label) for each order #.

The problem is that the orders come out in alphanumeric order, NOT the order I type them in.

E.G., if order # parameter is 'A04, A1, A01' the labels get printed in this order: A01, A04, A1. I want them to print out A04, A1, A01.

How can I eliminate the alphanumeric sort it is doing?


Solution

  • I figured it out. I had the output tablix (that contained the subreport) grouped on Order # and for that row group, I entered in the following for the sort expression:

    =Array.IndexOf(Split(Parameters!OrderNo.Value, ","),Fields!ORDER_NO.Value)

    Basically sorting on the index of the order # in the parameter. Worked like a charm.