Reputation: 1153
I want to create a Birt table report with dynamic number of columns from xml datasource. How can I go about it ?
While searching I have read that it can be done with scripted datasource but I couldn't find example or documentation of how to use scripted datasource with xml datasource.
I have also tried cross tab which only seems to work if there is some form aggregation (it doesn't work with strings).
Here is a sample xml:
<table>
<row>
<name></name>
<question_1>answer<question_1>
<question_2>answer<question_2>
</row>
<!-- or it can be like this. I can control how the xml is generated-->
<row>
<name></name>
<question>answer<question>
<question>answer<question>
</row>
</table>
the number of questions is different for different xml but they are the same for the rows within one xml. I want the data to appear in tabular form like this
name | question_1 | question_2
Upvotes: 2
Views: 4773
Reputation: 4332
As you mentionned it in the question, i think the easiest way to do this is a crosstab. Indeed datacubes work with numeric measures but we can workaround it by creating a dummy measure with the field "answer" as expression in the underlying datacube. Set the type of the measure to "String" and the aggregate function to "FIRST" , then the crosstab should display the answer of each question in cells
Upvotes: 2
Reputation: 624
You could do the following:
Upvotes: 0