Jump to content
Changes to the Jaspersoft community edition download ×

Jaspersoft Studio - Problem with dynamic tables using subreports


samuele.vigano

Recommended Posts

Hi Community,

I'm facing an issue in Jaspersoft Studio. I have a XML document source formatted as following:

<authors>    <occurrence index="1">        <author>            <name>William</name>            <surname>Shakespeare</surname>            <works>                <occurrence index="1">                    <work>                        <title>A Midsummer Night's Dream</title>                        <year>1595</year>                    </work>                </occurrence>                <occurrence index="2">                    <work>                        <title>Hamlet</title>                        <year>1602</year>                    </work>                </occurrence>            </works>        </author>    </occurrence>    <occurrence index="2">        <author>            <name>James</name>            <surname>Joyce</surname>            <works>                <occurrence index="1">                    <work>                        <title>Dubliners</title>                        <year>1914</year>                    </work>                </occurrence>                <occurrence index="2">                    <work>                        <title>Ulysses</title>                        <year>1922</year>                    </work>                </occurrence>                <occurrence index="3">                    <work>                        <title>A Portrait of the Artist as a Young Man</title>                        <year>1916</year>                    </work>                </occurrence>            </works>        </author>    </occurrence></authors> [/code]

and I have to define 2 different tables in Jaspersoft Studio:

One table is the table of "Authors" where I need to map only one row with name and surname of every author

The second row is the table of "Works" where I need to map for every author its works ("title" and "year").

The result must be like this:

"AUTHOR":

"NAME" "SURNAME"

  • WILLIAM,SHAKESPEARE

"WORKS":

"TITLE" "YEAR"

  • A Midsummer Night's Dream,1595
  • Hamlet,1602

AND

"AUTHOR":

"NAME" "SURNAME"

  • JAMES,JOYCE

"WORKS":

"TITLE" "YEAR"

  • Dubliners,1914
  • Ulysses,1922
  • A Portrait of the Artist as a Young Man,1916

Using subreports I can define the "AUTHORS" tables with one row per table but when I try to retrieve "WORKS" for every author I get an error because I retrieve the list of all the works and not only the works of that particular author.

The Xpath query used for this second table is "/authors/occurrence/author/works/occurrence/work"

Considering that in general I don't know a priori how many works there are in the XML for every author is there a way to retrieve the tables in the way I need?

Thanks

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...