A test block to experiment with building hierarchies from flat files. Pretty messy at the moment.
The flatToHierarchy()
function transforms a flat and wide table into a hierarchy based on a sequence of field names. Adapted from this Stack Overflow answer.