In the introduction to the Roadmapping project we created a rudimentary procedure and class that read in our data and created the basic structure we will need to produce generalized road-maps from simple tabular data.
The next step is actually the key activity, and the reason why recursion is a necessary technique for this project.
Each data row has as ID and Target as below
We need to create this structure from it.
Within our dotheMap procedure, once the data is read in - we have to execute a new method to 'rearrange our data items from the current flat structure, to a hierarchical one.
' sort out the parent/child relationships
That is split into 2 parts - first find all the the items who have the current item as their target and make the link, then break the link with the frame.
Here we are seeing the first recursion execution. Our debug report needs to call itself since the data structure now has an unknown depth of parent/child relationships. This is typical structure of a recursive procedure. Think of it like this - First deal with me, then call myself for each of my children.
Sometimes you need to do it the other way round - deal with the children first - thats very easy, just reverse the order . It really is that simple.
Here is our debug report that will now recurse since we have organized our data
...and here is the output - see if you can relate the order it comes out in to the Deal with me, then my children recursion order.
Next we are going to start plotting and creating shapes. But before we can do that we need to be able to calculate things like the height of the shape, which will be dependent on how many children an item has, and how many grandchildren etc. etc. However before even we can do that, one of the key things we are going to need is a way to provide parameter information such as colors, size and so on. Luckily, the cDataSet set of classes has a very straightforward capability for collecting parameters, so read on and we'll see how to get parameter values into our program.
cShapeContainer - Version 2
Roadmapper Module - Version 2
Public Sub RoadMapper()
Dim dSet As cDataSet
Set dSet = New cDataSet
' just need to provide the range where data headings are
If .Where Is Nothing Then
MsgBox ("No data to process")
' check we have fields we need
If .HeadingRow.Validate(True, "Activate", "Deactivate", "ID", "Target", "Description") Then
Services > Desktop Liberation - the definitive resource for Google Apps Script and Microsoft Office automation > Recursion > Roadmap Generation >