
Another collaborative solution today. Mikhail on the PeopleSoft reporting team had a tough little problem. Those of you that know PeopleSoft, will know that its full of 'trees'. A very powerful way of building hierarchies for all types of application e.g. financial accounts. However, lots of his customers want to be able to print the tree structures out.
Publisher is embedded inside PeopleTools so its just a case of writing the PSQuery and layut template right? Right, just need a little bit of a trick.
Mikhail was after something like the structure to the right. Notice the icons to denote leaf or node(folder) and the indenting to show the tree structure.
Thankfully his data contained everything needed to get the order and the indenting level.
<NODE>
<ID>00001</ID>
<DESCR>Corporate Headquarters</DESCR>
<Level>Corporate</Level>
<Type>N</Type>
<NodeIndent>1</NodeIndent>
<LineMap />
</NODE>
<NODE>
<ID>8200</ID>
<DESCR>Albright</DESCR>
<Level></Level>
<Type>L</Type>
<NodeIndent>2</NodeIndent>
<LineMap>C</LineMap>
</NODE>
<NODE>
<ID>8300</ID>
<DESCR>Vincent</DESCR>
<Level></Level>
<Type>L</Type>
<NodeIndent>2</NodeIndent>
<LineMap>C</LineMap>
</NODE>
To get the tree to render the template is pretty straightforward, just needed some tricksy hobbitises magic and some time.

I have reduced the width of the first cell to get the graphic to fit. You need to make it wide enough to fit the possible indenting you might need. The fields contain the following:

The higlighted field has the code to override the default start-indent attribute. Its just a calculation based on the NodeIndent value multiplied by a constant. You can mess with that to you hearts content. Notice the if@inlines for the leaf/node images, the @inlines prevents BIP from dropping in a new line character.
Its probably not a widely needed feature but I thought it was worth sharing, if nothing else, the rendered tree looks cool. As I mentioned, a collaborative effort, thanks again to Klaus and Hok Min for the solution.