Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
How can I retrieve multiple values from XPath Mapping in a Webservices Dataset?
richardc
Hi,
I am using a webservices datasource and dataset.
For a particular column value in a row in the dataset, according to the associated Column Mapping there could be multiple qualified values corresponding to the mapping. However, BIRT will only use the first matched value as the column value for that row.
Is there another way that I can retrieve multiple values for a particular XPath - perhaps by script or plugin? I just need to be able to iterate through the multiple node values to be able to concatenate them to display in the report. (see below).
The webservice data looks like (simplified version):
<mine>
<site_id>123</site_id>
<properties>
<property-type>A</property-type>
<property-type>B</property-type>
<property-type>C</property-type>
</properties>
<projects>
<project>1</project>
<project>2</project>
<project>3</project>
</projects>
<compositions>
<composition>X</composition>
<composition>Y</composition>
<composition>Z</composition>
</compositions>
</mine>
<mine>
<site_id>456</site_id>
<properties>
<property-type>A2</property-type>
<property-type>B2</property-type>
<property-type>C2</property-type>
</properties>
<projects>
<project>10</project>
<project>20</project>
<project>30</project>
</projects>
<compositions>
<composition>X2</composition>
<composition>Y2</composition>
<composition>Z2</composition>
</compositions>
</mine>
etc.
I need to display the data as:
Site ID | Properties | Projects | Compositions
123 | A; B; C | 1; 2; 3 | X; Y; Z
456 | A2; B2; C2 | 10; 20; 30 | X2; Y2; Z2
I have tried using row mapping of the dataset to property-type and then in the report layout using grouping to site_id. Then using aggregation to concatenate the property-type values. (That worked for the Properties). But I'm not sure how to do this for the other 2 multiple value nodes (projects and compositions). I considered creating another 2 datasets and joining them but that would add a lot of complexity to the report and would affect performance.
Please advise on how to achieve this.
Find more posts tagged with
Comments
mwilliams
Hi richardc,
Because of the way the file is set up, I don't know that you'll be able to access all of the mulitple values in one dataSet like you'd like to. Using multiple dataSets may be the way you have to go.
richardc
Hi Michael,
Thanks for that. I decided to redesign the xml:
<mine>
<site_id>123</site_id>
<misc>
<property-type>A</property-type>
</misc>
<misc>
<property-type>B</property-type>
</misc>
<misc>
<property-type>C</property-type>
</misc>
<misc>
<project>1</project>
</misc>
<misc>
<project>2</project>
</misc>
<misc>
<project>3</project>
</misc>
<misc>
<composition>X</composition>
</misc>
<misc>
<composition>Y</composition>
</misc>
<misc>
<composition>Z</composition>
</misc>
</mine>
By setting the row mapping to the 'misc' node, I can get all of the data for a single site id.
Cheers,
Richard
mwilliams
Richard,
Great! Let us know whenever you have questions.