Hitachi Vantara Pentaho Community Forums
Results 1 to 8 of 8

Thread: Want to generate key in for Denomaliser.

  1. #1

    Default Want to generate key in for Denomaliser.

    Hi,

    I have to denomalise the row to column:
    Below is the data I have:

    DATA VALUE
    Name XXX
    Place UK
    Phone 000000
    Name YYY
    Place US
    Phone 111111
    Name ZZZ
    Place EUR
    Phone 22222

    And I want to genrate the key like this:


    KEY DATA VALUE
    1 Name XXX
    1 Place UK
    1 Phone 000000
    2 Name YYY
    2 Place US
    2 Phone 111111
    3 Name ZZZ
    3 Place EUR
    3 Phone 22222


    Thanks in Advance.
    G_nish

  2. #2
    Join Date
    May 2016
    Posts
    282

    Default

    Maybe instead of using a row denormaliser I would use a Java Script with an output parameter KEY that increments each time that DATA has the value Name.
    Regards

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

    Default

    A row number (Add Sequence) before the Normalizer.
    Do not include it in the Normalizer configuration.

  4. #4
    Join Date
    Aug 2011
    Posts
    360

    Default

    Quote Originally Posted by gutlez View Post
    A row number (Add Sequence) before the Normalizer.
    Do not include it in the Normalizer configuration.
    It wont work, he needs to build a group key which increment every 3 rows (or every time there is DATA=name)
    so it wont work with add sequence nor value sequence.
    We definitly need a step for these kind of set/reset or increment/decrement based on an expression!
    The only way is with JS step since we can have a variable living from rows to rows (the counter)

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

    Default

    Sorry - I misread, and understood that the incoming data was:

    Name Place Phone
    XXX UK 0
    YYY US 111111
    ZZZ EUR 22222
    Marabu posted a few solutions where the "Group" gets calculated with a UDJE step and a group by step, and found it to be more efficient than Javascript.

    Javascript is a last-resort step. Do not use it unless you cannot find any other way to do the work.
    Last edited by gutlez; 06-29-2016 at 12:22 PM.

  6. #6
    Join Date
    Jun 2012
    Posts
    5,534

    Default

    With a fixed number of fields per row, your Add-Sequence would be my first choice, too, gutlez.
    Attached Files Attached Files
    So long, and thanks for all the fish.

  7. #7

    Default

    Thanks Marabu

    This helps me to get the expected result.

  8. #8

    Default

    Hi Marabu,

    can you help me in sorting this out.

    http://forums.pentaho.com/showthread...Rows-to-column

    Thanks in advance.
    g_nish

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.