A benefit of using SQL Server as a data source, is that it's possible to apply language specific sort sequences.
On occasions where we need to apply a specific sort sequence, this is something that is difficult to carry out through other means from Power Apps.
A popular example of a different sort sequence is that in traditional Spanish, "CH" and "LL" are treated as single letters. Therefore, these three words would be sorted in following sequence: lomo, luz, llama. (notice how llama comes last).
To demonstrate how to apply a language specific sort sequence to Power Apps, lets take the example of a table of Employees. The requirment is to sort this data using the traditional Spanish sort sequence.
If the collation of the database or the Employee table is set to traditional Spanish, Power Apps will apply the expected sort sequence. If not, we can create a view to apply our desired sort sequence like so:
CREATE VIEW vwEmployee
[Name] COLLATE Traditional_Spanish_CS_AI AS [Name],
Surname COLLATE Traditional_Spanish_CS_AI AS [Surname]
Notice how we use the T-SQL Collate function to apply the traditional Spanish collation. From Power Apps, we can now add this view to an app through the data panel.
Let's suppose we want to display a list of employees that are sorted by surname. The screenshot beneath shows how we can accomplish this by setting the Items property of a data table to a call to the SortByCoumns function.
Because this is a delegable expression, SQL Server applies the sort sequence and the results will appear in the data table control as expected. Notice how 'Chávez' appears correctly, after 'Conner'.
When we display non English data, there can be the requirement to sort data using langauge specific sort sequences. With SQL Server data sources, we can accomplish this by setting the collation sequence of the data, and we can use views to convert the collation sequence of data.