How to order nodes within OrgVue, using standard controls or expressions

This article outlines options available for ordering nodes, including supplied controls and programmatic method.  There is detail supplied of standard rules for ordering supplied in place, with a more detailed worked example at the end

Ordering: Standard Rules

  • The default structure of a given displayed hierarchy is built based on the pasted data depth first, top to bottom (lowest depth [1] to highest depth)
  • All standard Tree Views display nodes at a given level adjacent to other nodes at the same level e.g. all level 2s on the same horizontal
  • The default ordering of sibling nodes, before any subsets are applied, will be by ID ascending
  • Ordering set in Trunk datasets is retained on save.
  • Order of nodes cannot be branched, only reparenting (before/after) can be saved in branch views.

Ordering: UI Controls

There are supplied interactive visual controls, available within tree views, to determine order:

  • multiple controls are available by clicking on the node, including before, after, promote, demote
  • dragging and dropping in tree view triggers  an alternate dialogue for managing ordering

Order_-_screen.png

 

order__dialogue_.png

Ordering: Advanced Sort Using Expressions

There is general coverage of expression-based sort here, however if working with a Tree View an expression will have typically three elements e.g. in expression

nodes().sort("department").setSortOrder()
1 select all nodes
nodes()
2 select sort property
sort("department")
3 set the _sortOrder property of the nodes, which is only used for sibling ordering [visually]
setSortOrder()

When running an expression to set sort order visually, ensure before you proceed that

the dataset is free from any filtering or similar (pagination) before applying the sort function documented as here, as it needs to run on the whole dataset.

Ordering with Expressions: Worked Example

B1_-_unordered.PNG

In this simplified example, the required output is that siblings should be ordered by full name, in reverse order: the correct expression to apply should be:

nodes().sort("full name", "desc").setSortOrder()

First, ensure the sort order works as desired using Expressions Manager and check the sort order is correct for the sort-property using

nodes().sort("full name", "desc")

B1_-_expOrder.PNG

Once verified, 'fix' the sort order by adding .setSortOrder() to Expression Manager, ensure expression is run in Macro mode

nodes().sort("full name", "desc").setSortOrder()

 

B1_-_expOrderM.PNG

No change will be visible at this point - click refresh button (circular arrow)

B1-refresh.png

Save to retain settings ... and at this point you can run additional subsetting operations e.g. filter, paginate with the required ordering embedded.

Have more questions? Submit a request

Comments