Hitachi Vantara Pentaho Community Forums
Results 1 to 2 of 2

Thread: how to use a global variable?

  1. #1
    Join Date
    Jan 2017

    Exclamation how to use a global variable?

    hi all
    I want to read some records from mysql db and do something with these records,in some case,I need to use a variable(the variable can be read and modified with the last value) to record some state.
    but when I use "set variable" in the job, I found the variable's value could not be refreshed in the transform.

    my question is:
    (1) why the variable's value couldn't be refreshed in the transform?
    (2) how can I deal with it in this case?


  2. #2
    Join Date
    Jun 2012

    Default Global variables

    What does "global" mean in a transformation?
    Mind you, this isn't procedural programming!
    Most likely you think of a variable with a scope reduced to a step.
    You can have that with a scripting step like JavaScript or Java.

    Anyway, my answers to your questions are:

    1. It makes no sense to change transformation variables from a step due to the parallel nature of the steps. Imagine a variable V having states V[1] .. V[n] during processing of n rows. Since all steps are working on different rows at the same time, a later step expects to find state V[1] when an earlier step already produced state V[n]. Not a good idea.
    2. Tell us why exactly you think you need a "global" variable in your transformation and we might come up with a design idea that makes you forget about it.
    So long, and thanks for all the fish.

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.