Hitachi Vantara Pentaho Community Forums
Results 1 to 5 of 5

Thread: Cross-Platform Variables

  1. #1
    Join Date
    Jun 2013
    Posts
    5

    Default Cross-Platform Variables

    Hi, does pentaho have an implementation or syntax that supports cross-platform environmental variables?

    i.e. If a transformation is created in Windows, the user would use something like "%%foo%%/file.txt". However, if they then took the generated XML file and tried running it in Pan on a Linux system, this would obviously be a bad path.

    Is there a way to specify a variable so pentaho will instead perform a something like a System.getenv("foo") instead?


    We could build a workaround to perform the conversion of variables from Windows to Linux style but rather have a native implementation.

  2. #2
    Join Date
    Jul 2009
    Posts
    476

    Default

    Use the kettle.properties file to declare variables for machine-specific directory names. In the Windows version you could have something like
    Code:
    my.data.dir=c:/Users/me/DATA
    and on Linux it would be
    Code:
    my.data.dir=/home/me/DATA
    Then in the file dialog box, if you wanted to use a file called input.txt, you would specify its name as ${my.data.dir}/input.txt

  3. #3
    Join Date
    Jun 2013
    Posts
    5

    Default

    Quote Originally Posted by robj View Post
    Use the kettle.properties file to declare variables for machine-specific directory names. In the Windows version you could have something like
    Code:
    my.data.dir=c:/Users/me/DATA
    and on Linux it would be
    Code:
    my.data.dir=/home/me/DATA
    Then in the file dialog box, if you wanted to use a file called input.txt, you would specify its name as ${my.data.dir}/input.txt
    Does the kettle.properties file just appends/supersede the environmental variables? Isn't the "${my.data.dir}" syntax for Linux only still? If so, that still would not resolve my cross-platform limitation.

    We have a framework that loads up environmental variables already.... the issue I need to address is that pentaho XML itself may not support cross-platform. Does it solely rely on the OS/shell interpretation of variables? Can the Pan/Kitchen's XML parser perform a variable replacement when it sees a the pattern "%%foo%%" OR "${foo}" regardless of OS?


    i.e. Some of the other software we use interpretes both the "/" or "\" as path separators to facilitate cross-platform implementation of the same command. Even though "\dir\filename.txt" would be incorrect in a Linux shell, the software understands that you providing a path and correctly interpretes as "/dir/filename.txt" for Linux.
    Last edited by DuckieHo; 06-12-2013 at 01:37 PM.

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

    Default

    Quote Originally Posted by DuckieHo View Post
    Can the Pan/Kitchen's XML parser perform a variable replacement when it sees a the pattern "%%foo%%" OR "${foo}" regardless of OS?
    Yup!
    http://wiki.pentaho.com/display/EAI/.07+Variables
    Both formats can be used and even mixed
    **THIS IS A SIGNATURE - IT GETS POSTED ON (ALMOST) EVERY POST**
    I'm no expert.
    Take my comments at your own risk.

    PDI user since PDI 3.1
    PDI on Windows 7 & Linux

    Please keep in mind (and this may not apply to this thread):
    No forum member is going to do your work for you. We will help you sort out how to do a specific part of the work, as best we can, in the timelines that our work will allow us.
    Signature Updated: 2014-06-30

  5. #5
    Join Date
    Jun 2013
    Posts
    5

    Default

    Quote Originally Posted by gutlez View Post

    Perfect, thanks for providing the link.

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.