Hitachi Vantara Pentaho Community Forums
Results 1 to 8 of 8

Thread: Passing variable to report

  1. #1
    Join Date
    Oct 2007
    Posts
    9

    Default Passing variable to report

    We have an action script (xaction file) which uses a list box to prompt for some user input. The selected variable is past over to the report's query by this construct: {PREPARE:variable}

    Now I would like to have the past over variable shown also somewhere in the report’s header.

    How can I pass over the variable of the xaction script to the report? It’s not as simple as putting “{PREPARE:variable}” in the reports definition.

    Any help would be great. If someone thinks, this thread should be posted somewhere else within the pentaho forum, please give me advice, because I’m new at the forum.

  2. #2
    Join Date
    Jul 2007
    Posts
    1,013

    Default

    Yep, there's the reporting forum...

    Anyway, you need to create a Properties data set and add properties with names matching the input parameters from the xaction.

    Then you can reference these properties in a message field in your report.

    For example, if you had a "amount" property, you would reference its value as "$(amount)" in the message field.

    Cheers!
    Last edited by tdidomenico; 10-30-2007 at 06:16 PM.

  3. #3
    rhasija Guest

    Post

    That's a good description of what needs to be done. If you haven't figured it out yet, then I can try posting a simple solution.

    Also, search on here. You may find some examples already existing.

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

    Default

    In the Pentaho-Demo, there is the "custom-parameter-page-example.xaction" which takes a InputParameter and then takes the REGION parameter as input from outside.
    Get the latest news and tips and tricks for Pentaho Reporting at the Pentaho Reporting Blog.

  5. #5
    Join Date
    Oct 2007
    Posts
    9

    Default

    Thanks for advice and help, but it didn't solve my problem yet.

    I do have a messagefield in my report $(PRODUCTTYPE).

    In my actionscript I have a process input PRODUCTYPE, and I have a process action (relational) which fills the input source via an SQL.
    My report data sql works fine with this construct, here I pass the prompted input with {PREPARE:PRODUCTTYPE} and it works while processing the xaction.

    But the report message field $(PRODUCTTYPE) is left empty after processing.

    So I compare my xaction with the sample xaction, and the only difference is, that the example script works with internal values for their input fields. Could this be the
    a reason?

    So does anyone else has any idea?
    thanks in advance!

  6. #6
    Join Date
    Jul 2007
    Posts
    1,013

    Default

    In your "Pentaho Report" xaction, did you add PRODUCTTYPE as a Report Parameter, in addition to adding it as a process input?

  7. #7
    Join Date
    Oct 2007
    Posts
    9

    Smile

    Hi tdidomenico,

    Quote Originally Posted by tdidomenico View Post
    In your "Pentaho Report" xaction, did you add PRODUCTTYPE as a Report Parameter, in addition to adding it as a process input?
    this was the solution. Thanks a lot.

    I'm just wondering why in the sample reports and xaction for 'custom-parameters' is no item in 'Report Parameter'.
    But anyway, it works for me now! thanks.
    tombani

  8. #8
    Join Date
    Jul 2007
    Posts
    1,013

    Default

    That's because the xaction parameters are used in the SQL query, but -unlike in your case- there's no need to pass their value to the report engine separately.

    Cheers!

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.