How do I sort a FlexTable (such as pipe or conduit) in order of upstream to downstream?
By default, element FlexTables are ordered by their element ID, which is based on the order that they were drawn or inserted into the model. Sometimes it is necessary to view a FlexTable in a different order such as upstream-downstream, not by ID or label. This also allows the user to use the relabel function to change the labels of elements based on the order in the FlexTable. Our storm and sewer products have an ability to do so because the flow is always in the same direction. However our water modeling products can have flow in either direction, so the situation is different.
Starting with version 10.01.01.04, you also have the option to do a dendritic sort. This option is at the bottom of the right-click menu in Flextables (see below). When this is selected rows are arranged not only by their upstream to downstream connectivity but also grouped by branch. Links of a dendritic stormwater network can be well-labeled with the Branch Labeling tool, resulting in a clear designation of links organized into tributary branches. After this sort, the first rows appearing will be the elements within the upstream most branch, and appearing in upstream to downstream order within that branch.
NOTE: as of version 10.02.03.03, if the program crashes when using the sort dendritic option with an error "Specified argument was out of the range of valid values", this could be due to an issue with the model connectivity, such as an outfall whose "boundary type" is set to "boundary element" but with no boundary element selected (reference #1081335). Use the Validate command to locate and fix issues like this first before performing the sort.
Right click in the drawing plan view, choose "Edit Group", then double click the pipe table (or junction table, if you want to look at junctions). This will open a table filtered to only show elements along the path of interest.
Ensure that the Hydraulic grade (start) or Hydraulic Grade (stop) field is added to the table for pipes, or "Hydraulic grade" for junctions.
Right click the HGL start or stop field for pipes, or the HGL field for junctions, and choose either Sort > Ascending or Sort > Descending, depending if you want to sort upstream or downstream. This of course assumes that you have at least some flow in the pipes you're sorting, so as to have a decrease in HGL as you move downstream.
If you want complete control over order, you could add a numeric User Data Extension field (Tools > User Data Extensions), add that column to your FlexTable, enter a value to specify the order for each row, then sort by that field.
If you need to label your elements based on a specific order, such as upstream-downstream or based on the connection order of each branch of a branched system, first use the above guidance to get your FlexTable sorted in the order that you want the elements labeled. Filter the table down if needed (based on selection set or query for example) if you only need to relabel certain elements.
Next, Right click the Label field's column header, choose Relabel, then choose Renumber as the Relabel Operation. Configure the prefix, suffix, etc., and click OK.
How do I append a prefix to element labels based on a selection set of elements?