Hitachi Vantara Pentaho Community Forums
Results 1 to 3 of 3

Thread: How do you Create New Field in Javascript?

  1. #1
    Join Date
    Oct 2008
    Posts
    28

    Unhappy How do you Create New Field in Javascript?

    I read a text file and then used javascript to evaluate for error. I set a variable to store this error. I want to create this new field called TestError that will help me with the next Filter Row step.

    var TestString = trim(Employee_ID);
    var TestLength = TestString.length;
    var TestError;
    if (TestLength == 0)
    {
    TestError.setValue("Error");
    }

    However Spoon comes back with error.

    2008/11/01 17:10:54 - Modified Java Script Value.0 - ERROR (version 3.1.0, build 826 from 2008/09/30 11:32:36) : TypeError: Cannot call method "setValue" of undefined (script#9)

    I guess I wasn't successful in creating this new field. Can anyone suggest how I could create a new field in Javascript to aid in Filtering records under a certain condition?

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

    Default

    Some functions don't work anymore if you switch compatibility off, it seems like you're trying to use half of compatibility on/half of compatibility off. And in your case it just doesn't know what TestError is.

    In general to make a new "export" field, the easiest is to just add it to the table below in the javascript dialog.

    Example attached.

    Regards,
    Sven
    Attached Files Attached Files
    Last edited by sboden; 11-02-2008 at 05:23 AM.

  3. #3
    Join Date
    Oct 2008
    Posts
    28

    Smile

    Thx that worked great, hx for the great help!

    Much appreciated

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.