A few more brain cells kicked in after the last post and I realized I could delete the columns in the dataset while viewing the dataset, so I deleted all but the ones needed and then my SQL query was accepted with no problem. But I don’t remember having to do this on version 7.5.
I also noticed that there is a property in Tree View that I don’t recall seeing on version 7.5 named Auto Sort. I tried it out and all it does is change the sort on the Text fields within the paths, but not the paths themselves.
I modified the query above to just select the departments and positions in the order in which they are in the SQL table and purposedly reverse sort the employees for testing the Auto Sort property. I also removed the EmployeeSortOrder field from the Employees table and also the extra Jack Black employee that I accidently added. Here is the new Employee table.
And here is the new query.
SELECT
d.Department + ‘/’ + p.Position AS ‘Path’,
e.EmployeeLastName + ', ’ + e.EmployeeFirstName AS ‘Text’,
e.EmployeeLastName + ', ’ + e.EmployeeFirstName AS ‘SelectedText’
FROM
Employees AS e
INNER JOIN
Positions AS p ON e.PositionID = p.PositionID
INNER JOIN
Departments AS d ON p.DepartmentID = d.DepartmentID
ORDER BY
e.EmployeeLastName DESC, e.EmployeeFirstName DESC
Here is the way it queries in SQL Server.
And here is the way the Tree View looks with Auto Sort turned off.
Notice that the Departments and Positions are sorted alphabetically still, but the employees aren’t. Next, I turned on Auto Sort and here is what the Tree View looks like.
So I tried the trick pdibenedetto suggested, and thanks for that, by the way. With the html code, I was able to sort the paths as desired. Using the example above, I modified the query to use the html trick and here is what it looks like.
SELECT
‘
’ + d.Department + ‘/’ + ‘
’ + p.Position AS ‘Path’,
e.EmployeeLastName + ', ’ + e.EmployeeFirstName AS ‘Text’,
e.EmployeeLastName + ', ’ + e.EmployeeFirstName AS ‘SelectedText’
FROM
Employees AS e
INNER JOIN
Positions AS p ON e.PositionID = p.PositionID
INNER JOIN
Departments AS d ON p.DepartmentID = d.DepartmentID
ORDER BY
e.EmployeeLastName DESC, e.EmployeeFirstName
The query results in SQL look like this.
(continued in next message)