Hitachi Vantara Pentaho Community Forums
Results 1 to 3 of 3

Thread: get solutioni Root from BSH

  1. #1
    Join Date
    Mar 2009
    Posts
    205

    Default get solutioni Root from BSH

    In a BSF / Bean Shell script inside PRD 3.5 , I need to obtain the solution root (Like in Open Formula =ENV("SolutionRoot").

    Is there a way to obtain it, either from a pentaho class, or an easier way ?

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

    Default

    Just use the Java-Code
    Code:
     
    String root = PentahoSystem.getApplicationContext().getSolutionPath("");
    With 3.6, the report-environment is accessible from the script-functions via the "ExpressionRuntime".

    Code:
    ReportEnvironment env = runtime.getProcessingContext().getReportEnvironment();
    String root = env.getEnvironmentProperty("solutionPath");
    Get the latest news and tips and tricks for Pentaho Reporting at the Pentaho Reporting Blog.

  3. #3
    Join Date
    Mar 2009
    Posts
    205

    Default

    Thanks, it works great with a few minor changes (Thanks to Javadoc):

    * getEnvironment instead of getReportEnvironment
    * solutionRoot instead of solutionPath

    Code:
    import org.pentaho.reporting.engine.classic.core.*;
    ReportEnvironment env = runtime.getProcessingContext().getEnvironment();
    String root = env.getEnvironmentProperty("solutionRoot");
    Note: I'm using a ci build

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.