Hitachi Vantara Pentaho Community Forums
Results 1 to 3 of 3

Thread: My fisrt JavaScript

  1. #1
    Join Date
    Sep 2011
    Posts
    171

    Default My fisrt JavaScript

    Hello,

    I have written simple JavaScript that takes string from the stream and compares it with string in Array and returns value if one string is a subset of another. However, it is not working or rather it is working for some values only. I wonder if anybody could have a look and tell me what is wrong. I also attached files

    Regards,
    Alex


    Code:
    //Script here
    var MapDim = 3;
    var Mapping = [MapDim,2];
    var i; 
    var InstrCode = InstrType;
    var InstrCodeIRIS="default";
    
    Mapping[0,0]="ALTA";
    Mapping[0,1]="RMBS";
    
    Mapping[1,0]="POA";
    Mapping[1,1]="RMBS";
    
    Mapping[2,0]="Subprime";
    Mapping[2,1]="ABS"
    
    
    
    for (i=0;i<=MapDim-1;i++)
    {
     if (InstrCode.indexOf(Mapping[i,0]) !=-1)
    
        {InstrCodeIRIS = Mapping[i,1] }
    
    }
    Attached Files Attached Files

  2. #2
    Join Date
    Nov 2008
    Posts
    271

    Default

    Hi Alex,
    did you consider a value mapper step?
    Andrea Torre
    twitter: @andtorg

    join the community on ##pentaho - a freenode irc channel

  3. #3
    Join Date
    Sep 2011
    Posts
    171

    Default

    Thank you, Andrea!

    Do you know if value mapper accepts regular expressions? (I tried some regex there, but not sure if I am using it correctly)?

    Regards,
    Alex

    P.S.

    I got JavaScript to work, turns out JavaScript has a notions of array of arrays instead of multidimensional array.

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.