Hitachi Vantara Pentaho Community Forums
Results 1 to 12 of 12

Thread: Modified Java Script Value - not seeing variables set in previous transformation?

  1. #1

    Default Modified Java Script Value - not seeing variables set in previous transformation?

    I have tried to get a value lastDownloadDate set in a previous transformation using both Set Variables and Copy rows to result and I cannot seem to read a value.

    When I launch the transformation I see the value as a parameter, but for some reason it is not available to me when I look at the value using an Alert or try to use it within my logic.

    I am using a getVariable("lastDownloadDate","") and it always shows up as an empty string.

    When I try to use the datastream by using a Get rows from result, it claims that it is undefined.

    Using 3.0.0 RC2.

    Thanks.

    Marc Pike

  2. #2

    Default

    My logic is to look at this date and introduce a new field ignore (Y/N) but if I cannot look at the variables that have been set I am dead in the water again...

    Thanks in advance.

    Marc Pike

  3. #3

    Default

    This is the transformation attached:
    Attached Files Attached Files

  4. #4
    Join Date
    May 2006
    Posts
    4,882

    Default

    You do have to use something as second argument to getVariable.

    Regards,
    Sven

  5. #5

    Default

    Ok, I do not understand this, but it looks like the Get Files has to come before my get variables - this works, but is this a bug?

  6. #6
    Join Date
    May 2006
    Posts
    4,882

    Default

    I also have no idea why you want to use get variables and file input like you do it now.

    If you define the variable in your environment you shouldn't need get variables step. Get variables steps is required if you want to put "variables in a row as value, it's not required if you just want to use the variable as you do now in text file input.

    Regards,
    Sven

  7. #7

    Default

    The reason for requiring the value(s) in my rowset is so that I can access it within my javascript to filter out the older dates. If the Modify Java Script Value would have recognized the variables like it appears to, but does not, I would have had no problems, but I need to perform logic and the Get File names seems to wipe out any previous values and I cannot see them in javascript.

  8. #8
    Join Date
    May 2006
    Posts
    4,882

    Default

    Quote Originally Posted by marc.pike View Post
    but I need to perform logic and the Get File names seems to wipe out any previous values and I cannot see them in javascript.
    This is "legacy".

  9. #9

    Default

    huh? What does that mean?

  10. #10
    Join Date
    May 2006
    Posts
    4,882

    Default

    It's how it used to work, and still works now. Some of the steps will "ignore" input they get on incoming hops.

    Sven

  11. #11

    Default

    I see, would be nice if it did not ignore it, since it is displayed as an input field, I was under the assumption that it would work.

    Oh well, so if I move the Get Files first, then do the Get Variables it seems to work correctly, is that to be the best practice?

  12. #12
    Join Date
    May 2006
    Posts
    4,882

    Default

    If it works for you, yes

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.