Hitachi Vantara Pentaho Community Forums
Results 1 to 6 of 6

Thread: How to pass parameter from PDi To PRD's PDI source?

  1. #1
    Join Date
    Jun 2016
    Posts
    181

    Default How to pass parameter from PDi To PRD's PDI source?

    I have tranformation:

    Get File Names => Modified Java Script Value (where I create paths for report definition file and output file and path to Excel file) => Pentaho Reporting Output

    PRD report (Pentaho Reporting Output step) base on PDI transformation. I need to receive parameter from first transformation and use it to pass to PRD query transformation (this is the name of Excel file to open).

    The PRD query transformation is:

    Get System Info => Microsoft Excel Input (read filename from step) => Sort rows


    Well, I just try to find solution... No idea if Get System Info is able to receive parameter ("command line argument" type there)... no idea if the parameter, string (path to excel file), can be read by Microsoft Excel Input...

    Anyone can help?
    Regards

  2. #2
    Join Date
    Apr 2008
    Posts
    4,696

    Default

    Break it down into smaller chunks.

    Does your report work in PRD?
    If it doesn't, you'll have no hope of getting it to work in PDI.

    You don't want to use "command line argument" you want to use actual PDI Parameters. These get presented into PDI as variables. Excel Input should be able to handle variables. You can make sure that this part works by running it in PDI with your run screen. If you can get it to work from the Preview tab, then you're likely well on your way to getting it to work in PRD.

    Then your Report in PRD also has to have parameters. These are the values that you would be supplying if you ran the report interactively. The PDI step "Pentaho Reporting Output" is basically a way for you to automate running a report with different parameters. So you could have an entire table of parameters to run, each getting a different file... That's what the step does.

    So.

    PDI Inside ( Requires Parameter - ExcelFileName) : Microsoft Excel Input -> Sort Rows
    Make sure you can run this from the command line without errors.
    PRD (Requires Parameter - ExcelFileName) : Passes Parameter to PDI, and retrieves the dataset and formats it.
    Make sure you can run this from within PRD without error.
    PDI Outside: Get File Names -> MJSV -> PRO ... Note: Pass Filename as parameter to PRD...

  3. #3
    Join Date
    Jun 2016
    Posts
    181

    Default

    Thank you Gutlez for all suggestions.

    My PDI inside seems to work. In Transformation properties, Parameters pane, I added 'ExcelFileName' parameter (no default value). In Microsoft Excel Input (PDI inside) in Files pane in Selected files as a filename I inserted variable ${ExcelFileName}.
    I was able to run report in PRD. Looks like it works.

    But, I'm not able to run it from command line:

    pan.bat /file:"D:\Pentaho\Workspace\Test\sample.ktr" /param:ExcelFileName="D:\Pentaho\Workspace\Test\out\10132.xls"

    Reports "Command line option not understood" and does nothing.


    PDI Outside: Get File Names -> MJSV -> PRO for some reason reports some unlogical error: "There was an unexpected error processing report ...The file name, directory name or volume label syntax is incorrect"
    Checked paths and all are correct.
    Also the parameter I sent to PRD from this transformation has a correct name and value.

  4. #4
    Join Date
    Jun 2016
    Posts
    181

    Default

    OK, I found the error. Oryginally directory pointer "getVariable("Internal.Transformation.Filename.Directory"," ")" produce "file://..." prefix. Have to cut it to receive correct file pointer syntax.

    Thanks a lot for your help!!! I really appreciate your great job you do...

    bwt, I do not know why my pan.bat command is not correct :-(

  5. #5
    Join Date
    Apr 2008
    Posts
    4,696

    Default

    Quote Originally Posted by Gosforth View Post
    bwt, I do not know why my pan.bat command is not correct :-(
    Because PDI wants weird quotes is likely the issue...

    try:
    Code:
    pan.bat "/file:D:\Pentaho\Workspace\Test\sample.ktr" "/param:ExcelFileName=D:\Pentaho\Workspace\Test\out\10132.xls"

  6. #6
    Join Date
    Jun 2016
    Posts
    181

    Default

    Better now :-)
    Thank you!

Tags for this Thread

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.