Alphabetical.. somewhat

I have a BAQ report which is supposed to sort by employee name alphabetically. In the query, it works fine. I am using the information in an SSRS report. I use a list to put together the form. When the report comes back, it is mostly in order with the exception of a few records. If I alphabetize by first name, 4 are incorrect. If I order by last name, those same 4 are incorrect plus 2 more. If I take the sort out of the BAQ and add one to the BAQ Report, same results.

It is not printing them in Employee ID order (was a thought). If I remove the order altogether, it prints in a different list than when the sort is applied. So it kinda alphabetizes, but not all of them.

For perspective, the report has 160 records and only 4 (or 6) are incorrect.

Any ideas or thoughts?

First thoughts are leading spaces. I am guessing you checked for that. So, my next thought is, can you sort right in the SSRS instead, skipping the BAQ sort and the BAQ Report sort?

2 Likes

I mean, it is odd, but if it takes a while to figure out why, maybe do a row_number() as the sort?

Also, unrelated and to get on @ckrusen ‘s nerves, when did Windows’ sort function become so stupid?

MRP2 gets wedged between MRP-001 and MRP-002, etc. They try too hard sometimes.

1 Like

Some sort utilities are built to ignore certain character types. Not sure what windows is doing here but it could be eliminating the spaces and symbols before sorting.
This habit also goes way back to the time of paper phone books and yellow pages, where they would not include spaces when doing the sorts.
Aa b
Aab
A ab
Aa b
It could turn out random looking.

Leading spaces or unreadable characters were my first thought - not the case.

I tried sorting in the SSRS but had issues. First, I’m using a grid and not a table. Not sure if that will make a difference or not but I’m printing off forms and not a table (employee reviews) When I go into the sort section of the SSRS, no fields populate:
image

I tried just typing in the field name since it does show up in the report, but it just ignores it.

1 Like

In this case I’m having a last name that begins Cas being inserted between ones beginning with Bar and Bet. Other examples are similar. As stated, the alphabetizing is correct within the query itself, just incorrect when the report is printed.

If you have a good sort in BAQ, I might avoid this headache and do like @JasonMcD said. Those row_numbers are very helpful!

So, I do SSRS like once a year, but as for sorting, I just pulled up a report I made and my sort is on the group:

But again, not my wheelhouse.

So I did as you suggested. In the BAQ, it is ordered by name alphabetically. I then added a sort on the BAQ Report Designer sorting by the Calculated_RowNumber. Prints in the same order.

I left it named Name for the sort for less confusion for others using it but sorted by the name.

I went back to the report and added the row number so I could see if it messed up the numbers when sending to SSRS but it does not. Report runs and prints in the row number order 1, 2, 3, 11, 4… etc.

So went back in again to the SSRS and now the field is showing in the same dropdown it wasn’t before.

image

Why it’s now in the tablix properties when it wasn’t before, I’m not sure. Considered I was just losing it but in the prior screenshot, it’s not there.

Once adding it there, the order is working. Thanks for the help. Greatly appreciated.

2 Likes

I recall seeing a method to address this. Not sure if it was on here, or on another forum.
(yes there are other forums on the Internet)

More so from imported data, But I’ve had to expand strings into individual characters and display their ASCII code. There is a space that has ASCII code 160(dec). Or there’s an em-dash vs an en-dash vs a regular dash. And there straight quotes, and fancy quotes (Both for double and single quotes).

These odd characters often get in when someone copies text from a website or PDF, and the source used some funky characters.

And I’ve no idea how Unicode encoded strings are sorted.

Yes, sorry, I intended to specify that part but forgot.

Right, if you know it works in one situation, just force the other situation to honor it.

Yeah, SSRS does its own thing for sorts.

:-1:

Blasphemy

1 Like

Windows File Explorer file name sorting:

Numerical sorting in File Explorer is enabled by default in Windows 10.

When numerical sorting is enabled, File Explorer will sort file names by increasing number value
(for example, 3 < 22 < 111).

When numerical sorting is disabled, File Explorer will sort file names by each digit in a file name
(for example, 111 < 22 < 3).

1 Like

Don’t know how I missed that before lol.

But I sure did do the regedit change.

…Balance is restored to the Force.

image

1 Like