How can I conditionally display information based on the selected group by?

I have a question about conditionally displaying data in the information panel. Right now, for leaf nodes we display much of the data in a table in the format "[[attribute]]: [[value]]". And for non-leaf nodes, we display the list of children within the category. I was wondering if for non-leaf nodes, if it would be possible to display a description of the node you are mousing over. For example, lets say our data file looks like:

Category,CategoryDesc,Function,FunctionDesc,Item Category1,CategoryDesc1,Function1,FunctionDesc1,Item1 Category2,CategoryDesc2,Function2,FunctionDesc2,Item2

And you have two views:

Category --> Function --> Item
Function --> Category --> Item

When you hover over "Category1", you would display "CategoryDesc1" in the info panel, and likewise, if you hover over "Function2" display "FunctionDesc2". Is there any way of doing this currently?

We had almost exactly the same request several months ago, and we added a quick way to do this. Basically, you can reference the values of a child cell from a parent cell. So when "Function" has the focus, it can reference the data values of the "Item" cell. For instance:

${node.data['Function']} returns "Function" for the focused node
${node.child[0].data['FunctionDesc']} returns the "FunctionDesc" for the first child of the focused node

Now, when we developed this solution, the customer was not rearranging their hierarchy. You have an added complexity in that we are generally defining panels based on the level of the node being focused on. So, let's assume you define:

<panel>
  <context level="2">

  <title><format>
     ${data['Function']}
  </format></title>

  <description><format>
     ${node.child[0].data['FunctionDesc']}
  </format></description>
</panel>

Well, this works great under this hierarchy:

Category --> Function --> Item

But, once we switch to:

Function --> Category --> Item

You are suddenly getting the values for Function displayed whenever a Category node is focused (because Category is now level 2).

Okay, so you can't do it the traditional way. But I think with the new functionality in 2.2, you can try a new way to do it. Basically, let's define panels not based on their level, but on the node being displayed. For this, we need to figure out an expression that will work.

Without going through the logic ("left as an exercise"), the expression we need is:

${node.data['Function'] != null and
  node.parent.data['Function'] == null}

Basically, if the data value for a given column is not null on the current node, but null on its parent node, then we must be looking at the grouping node for that column.

Okay, so let's put this into practice with our sample panel:

<panel>
  <context type="expression"
           expression="${node.data['Function'] != null and
                         node.parent.data['Function'] == null}">

  <title><format>
     ${data['Function']}
  </format></title>

  <description><format>
     ${node.child[0].data['FunctionDesc']|
       node.child[0].child[0].data['FunctionDesc']}
  </format></description>


Okay, so this is pretty much the same as the panel above except for two changes. First, I used an "expression" context rule to define when the panel should appear. Second, I added an or clause to the description that first checks the FunctionDesc on the node's first child, and then if that is null, checks the FunctionDesc on the node's grandchild. This handles displaying the description properly for both one and two-level hierarchies.

Do the same thing for each panel you want to display a specific description.