Jump to content
Changes to the Jaspersoft community edition download ×

Subreport should get all values


JoergSch

Recommended Posts

Hello.

I got a XML file like this:
 

<positionen>    <position aufpos="10" seblpos="0">        <posdaten isTextpos="0">            <identnr>1206030100</identnr>            <benennung lang_ext="de_de">                <zeile format="ascii">Row 1</zeile>                <zeile format="ascii">Row 2</zeile>            </benennung>            <benennung lang_ext="de_de">                <zeile format="ascii">Row 3</zeile>                <zeile format="ascii">Row 4</zeile>            </benennung>...[/code]

The XPath of the Subreport is

((net.sf.jasperreports.engine.data.JRXmlDataSource)$P{REPORT_DATA_SOURCE}).subDataSource("/position/posdaten/benennung/zeile[position()>4]")[/code]

But id does not 'find' the "Row 3" and "Row 4"...?

There's also a "Print when" for the subreport:

new Boolean ($F{cnt_benennung}.intValue() > 2)[/code]

And if I print out $F{cnt_benennung}.intValue() it displays correct a "4"

So how can I solve this to get Row 3 and 4 in the subreport?

 

Thanks for your help,
Jörg

Link to comment
Share on other sites

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

1. Are you sure that $F{cnt_benennung}.intValue()   count a "zeile" but not "benennung" ?
2. Positions for Row 2 and Row 4  equals 2 but not 4  imho
3. It is not clear for me how you can "find"  Row 1 and Row 2  with condition   =  zeile[position>4]

Question unclear.

Link to comment
Share on other sites

Hi sanbez.

  1. Yes, $F{cnt_benennung}.intValue() counts "zeile", it's a bit confusing description, but the definition is correct: count(/position/posdaten/benennung/zeile)
  2. If I print out the value of $F{cnt_benennung}.intValue() I got a "4" as expected.
    So I hoped, to get only the rows of the second node "benennung"
  3. Rows 1 and 2 shouldn't be found but skipped.
    But sorry, there was a copy'n'paste Error... the XPath ends with .../zeile[position()>2]

For more Details:
I got this report and I couldn't change, only extend the XML in this way... otherwise I would have inserted more "zeile" at the right place.

But the question is the same:
Why the count find more then 2 rows, but the subreport not?

 

Thanks for your support!

Jörg

Link to comment
Share on other sites

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...