Hitachi Vantara Pentaho Community Forums
Results 1 to 7 of 7

Thread: New Row with manipulated values does not work...

  1. #1
    Join Date
    Mar 2009
    Posts
    137

    Default New Row with manipulated values does not work...

    Hi everybody,

    I know that I can do the following using different steps (than the JavaScript-Step)... but this is just an example which does not work... and I need this to work

    Code:
    var test1 = 0;
    var test2 = "";
    
    // the field tata is given by Input
    var theNewRow = createRowCopy(getOutputRowMeta().size());
    var theIndex = getInputRowMeta().size();
    
    // tata is increased by one
    var priority = tata + 1;
    
    // A new row is added with the increased value
    theNewRow[theIndex++] = priority;
    theNewRow[theIndex++] = "increased";
    putRow(theNewRow);
    the input is are generated rows (10) with a value of 1 named tata

    the result looks like that
    Code:
    tata    test1    test2
     1        internal_info
     1    0    
     1        internal_info
     1    0    
     1        internal_info
     1    0    
     1        internal_info
     1    0    
     1        internal_info
     1    0    
     1        internal_info
     1    0    
     1        internal_info
     1    0    
     1        internal_info
     1    0    
     1        internal_info
     1    0    
     1        internal_info
     1    0
    Is that a bug?? Or how can I modify values using JavaScript (I have to use a JavaScript
    Attached Files Attached Files

  2. #2
    Join Date
    Nov 1999
    Posts
    9,729

    Default

    I would rather people didn't modify values using JavaScript. You really don't need it at all. (certainly not with version 3.2 or higher)

    http://wiki.pentaho.com/display/EAI/...2.5.x+to+3.0.0

  3. #3
    Join Date
    Mar 2009
    Posts
    137

    Default

    Quote Originally Posted by MattCasters View Post
    I would rather people didn't modify values using JavaScript. You really don't need it at all. (certainly not with version 3.2 or higher)

    http://wiki.pentaho.com/display/EAI/...2.5.x+to+3.0.0
    But sometimes it is the only way (I guess)... Look at the attached example (example2.ktr) and tell me how else I should do that... (it could be a solution for my problem: http://forums.pentaho.org/showthread.php?t=70713)... so is it not possible to modify a value of an existing column (even by using new row)?

    It is ok if someone just tells me that this is not possible - or that my english is to bad to understand the problem

    Thanks!
    Attached Files Attached Files

  4. #4
    Join Date
    Nov 1999
    Posts
    9,729

    Default

    It's NEVER the only way. There is ALWAYS another way.
    In the worst case, you can create a new value and discard the old one.

    It's your transformation, do as you like, but please don't complain about data conversion issues if things fail then. JavaScript is a dynamic (weakly typed) scripting language, not exact science. :-)

  5. #5
    Join Date
    Mar 2009
    Posts
    137

    Default

    Hi Matt,

    thanks again... I bet its never the only way... now the but... did you look at my transformation? In my case I cannot just create a new value and than (in another step) discard/replace the old one... cause I don't know the changed values (I just know the position)...

    Well I try to find another way...
    Last edited by Jogilein; 06-30-2009 at 07:28 AM.

  6. #6
    Join Date
    Mar 2009
    Posts
    137

    Default

    I'm thinking and thinking to get another solution... well no solution yet and I really hope that there is always another way (see attached table.jpg).

    I guess the table shows it pretty clear...

    I have the value (column "value") that should be in the column (given by the column "column"), I know the position of the column (column "position") and the type (column "type"). But how can I modify the value without using the JavaScript? Any steps available to do what I want?
    Attached Images Attached Images  

  7. #7
    Join Date
    Nov 1999
    Posts
    9,729

    Default

    I get it, it's one of these "clever" systems that tries to limit disk size (but actually increases it) by capturing changes on a field level. I worked in a bank once where they had a similar system.
    The PL/SQL I had to write then to get it back into natural rows was very ugly and very slow. I *have* to feel a lot sympathy for you for that reason alone :-)

    Anyway, have a look at the "Denormalizer" step. That one basically performs the key-value pair lookup for you. Position/Fieldname/Type are all linked so you shouldn't worry about those too much. It's not like they can change the position, fieldname or type smack in the middle of the game without warning.

    So you end up with say position/value. Position is the key in the denormalisation process. This has the advantage of being very fast too.

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.