Hitachi Vantara Pentaho Community Forums
Results 1 to 4 of 4

Thread: Javascript get all stream data

  1. #1
    Join Date
    Jul 2016
    Posts
    2

    Default Javascript get all stream data

    Hi guys,

    with Javascripts is possible get all data from the stream in "one shot"?
    Example:

    My stream has 100 lines:

    ID;COL_A;COL_B
    --------------------
    1;DEADPOOL;MY FAVORITE MOVIE IS DEADPOOL
    2;LOGAN;MY FAVORITE MOVIE IS DEADPOOL
    3;IRONMAN;MY FAVORITE MOVIE IS IRONMAN
    4;HULK;MY FAVORITE MOVIE IS LOGAN
    ....
    ....

    For each line I need to know if the string in COL_A is contained in COL_B and in which line.
    In this case we have:

    DEADPOOL contained in line with ID 1 and 2
    LOGAN contained in line with ID 4
    IRONMAN contained in line with ID 3
    HULK no entry

    Thank you in advanced.

  2. #2
    Join Date
    Nov 2013
    Posts
    382

    Default

    Read the file twice. Use Join rows step to join File2 [Col3] CONTAINS File 1 [Col2].

  3. #3
    Join Date
    Jul 2016
    Posts
    2

    Default

    Thanks for your reply.
    I need to use a Javascript step because I have some logic to apply.
    Do you think is possible?

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

    Default

    Quote Originally Posted by dpanichi View Post
    Thanks for your reply.
    I need to use a Javascript step because I have some logic to apply.
    Do you think is possible?
    Step away from the Javascript. It is one of the LEAST PERFORMANT steps in PDI.

    You want to split the file into to streams: ID,Col_A and ID,Col_B and then do a cartesian join on the data. Filter the data, and you're done.

    PDI does NOT work like a function based programming language, nor like a procedural language. Must programmers struggle to make the shift.

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.