How are records on the Gantt Chart Sorted
Like the calendar records, the gantt chart items are sorted towards the end of the script "Cast Events as Variables - Build Query". There you'll see three sets of script steps sorting a) the regular (non-gantt) calendar, b) the gantt chart when sorted by date, and c) the gantt chart sorted by project.
You probably won't want to change any of these three sorts as the calendar display, and the hierarchical nature of the gantt chart (showing events beneath their projects) depends on it.
But if you do want to change the last of these, the gantt-as-project sort, here are a few things to keep in mind...
The gantt chart sorts each time an edit is made using drag and drop.
You can only sort by fields that are used in the SQL query earlier in the script. Fields are referenced by the order they appear in the query, so sorting by "6', means the sixth field returned: the Project ID.
The field z_MilestoneSort in the events table can be used to specify in which order events appear in the gantt chart. When this field is blank, events are shown in chronological order from first to last.
When there are values in z_MilestoneSort, events within a project or phase are shown in the order of the numbers in this field. (You'd number your events 1, 2, etc. Decimals are respected.) In this way you can have events start, lower down on the chart, before events in the upper part of the chart. This is essential for most complex projects.
You'll find this z_MilestoneSort field shown at the left edge of the events portal on our Sample Projects layout.