Hitachi Vantara Pentaho Community Forums
Results 1 to 9 of 9

Thread: Subreports on steroids?

  1. #1
    Join Date
    Apr 2007
    Posts
    2,009

    Default Subreports on steroids?

    Hi,

    I've got a great subreports question here

    I'm working with someone who has used oracle's reporting tool, and this is a concept which works there apparently.

    It's all about looping, and displaying multiple subreports. here goes..

    Say we have a first data set, Perhaps a list of products, and product associated information. A simple query to do at the sql level.

    We then want to display detail on sales of those products - now, this is also simple, but coming from another data set.

    So effectively what I want to do is to loop through a list of products, and for each one, call a subreport, which takes it's data from a portion of another result set, at a given point - i.e. for the right product id.

    Does that make sense? Is it possible? Am i on drugs today?

    Thanks,
    Dan

  2. #2
    Join Date
    Mar 2003
    Posts
    8,085

    Default

    Why not add a subreport to your master's detail section, and then give your subreport a parametrized query ala "SELECT * FROM PRODUCTDETAILS WHERE PRODUCTLINE=${prod_line_from_master}".

    We do not slice large resultsets, as looking up a number of records based on a condition should never been done on the client-side, when there is a perfectly suitable "WHERE" condition available.
    Get the latest news and tips and tricks for Pentaho Reporting at the Pentaho Reporting Blog.

  3. #3
    Join Date
    Apr 2007
    Posts
    2,009

    Default

    i didnt know you could do that. I presume that means the report runs the query rather than the xaction - which is fine.

    i'll play.

  4. #4
    Join Date
    Mar 2003
    Posts
    8,085

    Default

    In the old PRD (3.0) and earlier, the subreport's queries translate into some weird inner components in the jfreereportcomponent in the XAction.

    Beginning with Citrus, the engine's native datasources are used to execute these queries. My standpoint is that XActions should only perform the query, if you intend to preprocess the result via a JavaScript step or something similar. For everything else, there are engine-datasources available so that you wont have to go into Design-Studio for editing queries.
    Get the latest news and tips and tricks for Pentaho Reporting at the Pentaho Reporting Blog.

  5. #5
    Join Date
    Apr 2007
    Posts
    2,009

    Default

    Ok, as you guessed we're stuck on an old platform - 1.7 at the moment.

    For some reason, all of our reports use xactions to get the data - it was always done like that and i was happy to use PDS to manage it like that so i never looked for any other way!

    Anyway giving this a go today.

  6. #6
    Join Date
    Mar 2003
    Posts
    8,085

    Default

    Even then: Have a look at the samples. Some of the steelwheels samples use parametrized subreports in exactly the way I described. (After all, what use would a subreport have if it always shows the same data.)
    Get the latest news and tips and tricks for Pentaho Reporting at the Pentaho Reporting Blog.

  7. #7
    Join Date
    Apr 2007
    Posts
    2,009

    Default

    ok. We use subreports extensively to combine multiple reports into one! it's useful!

    This is way more interesting like this though, i grant you that!

  8. #8
    Join Date
    Apr 2007
    Posts
    2,009

    Default

    exactly which samples? there's hundreds.

    At the momment i'm stuck with this error:

    Error: org.pentaho.actionsequence.dom.ActionInputConstant cannot be cast to org.pentaho.actionsequence.dom.ActionInput (org.pentaho.plugin.jfreereport.JFreeReportComponent)

    I've read forums and very confused about what component does the querying. I see reference in the samples to PREPARELATER syntax used in the xaction.

    What I tried to do was define the queries in the REPORT, and not pass any queries to the report from the xaction. But that seems to have caused this cast error?

    So do you have to pass at least the "default" query from the xaction, but not the subreport ones?

    Last edited by codek; 07-23-2009 at 07:08 AM.

  9. #9
    Join Date
    Apr 2007
    Posts
    2,009

    Default

    Ok, i have it working.

    I resorted back to the queries in the xaction, and use of seemingly secret PREPARELATER syntax.

    yes yes! i'm a secret lover of xactions, even if no one else is. But even so this solution means i have way nicer database queries, albeit more of them are executed, and only a slightly more complicated report. It's great that again i've come to do something new/different and been able to do it right away.
    Last edited by codek; 07-23-2009 at 11:45 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Privacy Policy | Legal Notices | Safe Harbor Privacy Policy

Copyright © 2005 - 2019 Hitachi Vantara Corporation. All Rights Reserved.