Hey Michael, would you mind sharing the CSV, with sensitive info removed? I'll see if I can repro and fix it.
2 of 2 people found this helpful
Michael, the issue is that VizAlerts is treating your Consolidated Sort column as text, rather than as a number, so it is sorting alphabetically. Therefore "10" comes directly after "1", then "11", and so on. I'd recommend ensuring that your Tableau workbook is treating that field as a string, and prepending "0" to anything below 10 to ensure the right sort order.
And, for what it's worth, the docs do mention this...
When we’re using consolidated alerts, we often want the content to be generated in a specific order within each email. The Sort Order field lets us do that. When it is present, the values in the field are used to alphanumerically sort each row in the trigger view for each email or SMS. Here’s an example setup from the VizAlertsDemo\AdvancedAlertsTests worksheet:
Don't feel too bad, I had forgotten it works this way too. Doesn't help that the demo uses numbers for sorting, either. And this happens often enough that I think it's probably worth writing a little code to auto-detect if only numerical values are used, and sorting numerically if that's the case. Here's the issue I created to track this. Thanks for reporting! Let me know if you're able to implement the workaround to fix this.
OK, that makes perfect sense, thank you. I tried to find a pattern in the resulting sort but did not think of the "1,10,11" problem.
And yes, I found a workaround. I can't transform the number into a string in Tableau because I'm using it to get banded rows in the HTML table (basically using INDEX() % 2 to find out if it is an even or odd line and then inserting one or the other of the band colors into the table row element). That's the only way I found to get banded rows rendered correctly in Outlook.
For the sorting I use another field now, namely the category field. So I created a new calculated field called "Sort Order" with UPPER([Category]) as a formula for a case-insensitive sort directly on the name of the category.