WillyC
WillyC

Reputation: 4705

Creating grouped tablix in SSRS with hierarchical xml

I fear this just may not be possible, but I'm trying to create a grouped tablix in SSRS (Report Builder 3) using hierarchical xml.

For example, when providing the following xml as a parameter:

<people>
 <person>
  <name>person1</name>
  <colours>
   <colour>purple</colour>
   <colour>orange</colour>
  </colours>
 </person>
 <person>
  <name>person2</name>
  <colours>
   <colour>blue</colour>
   <colour>red</colour>
  </colours>
 </person>
</people>

I'd like some way to get an output formatted like this:

person1 purple
person1 orange
person2 blue
person2 red

The specific output format isn't critical, but at the moment I can find no way of correlating data at different levels of an XML hierarchy. I can create a table listing the people, and a table listing the colours, but I have no way of linking the colours to the people. (the data is completely contrived)

I feel like I've come at this from 1000 different angles - is this even possible?

Upvotes: 2

Views: 911

Answers (1)

WillyC
WillyC

Reputation: 4705

(Now that I'm able, I thought I'd post my solution as an answer to my own question.)

Well, funny how you can look at something for a day and then the moment you post it, you figure it out. Posting my answer here just in case.

In the dataset, the element path of the query should be:

<ElementPath>people{}/person/colours{}/colour</ElementPath>

Then using a field named "colour" in the same dataset as "name" will group properly by the parent element. For some reason I thought datasets in Report Builder were only valid at a single level of the hierarchy. I was wrong.

Upvotes: 2

Related Questions