Hitachi Vantara Pentaho Community Forums
Results 1 to 8 of 8

Thread: Adding new field to all rows

  1. #1
    Join Date
    Feb 2017
    Posts
    4

    Default Adding new field to all rows

    Hi,
    I need to cut a date field from header of a file and then add this to all rows.

    HEADER 03/01/2017
    A B C
    E F G

    so need to add this as:

    A B C 03/01/2017
    E F G 03/01/2017

    What is the best way to do it?

    Help appreciated!!

  2. #2
    Join Date
    Feb 2017
    Posts
    13

    Default

    Try this

    step 1:Get file name, use string functions and set it as a variable.
    step 2: Pass the table input and add a constant to it.
    step 3: Give the variable as the the value.

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

    Default

    Here's what I would do:

    • Text-File-Input with header turned off will let you process all rows.
    • If you enable rownumbers you can later split the first row off for date extraction.
    • Then you can use Join-Rows to add the date to each row.
    So long, and thanks for all the fish.

  4. #4
    Join Date
    Feb 2017
    Posts
    4

    Question

    Quote Originally Posted by rsdp View Post
    Try this

    step 1:Get file name, use string functions and set it as a variable.
    step 2: Pass the table input and add a constant to it.
    step 3: Give the variable as the the value.
    add constant doesn't allow to join to the output file.
    I use clone row for header row, then string cut and now want to add this to the output file.
    string cut --> add constant --> output text file.
    But it errors out with diff number of rows in two operations o/p

  5. #5
    Join Date
    Feb 2017
    Posts
    4

    Unhappy

    Quote Originally Posted by annanta View Post
    add constant doesn't allow to join to the output file.
    I use clone row for header row, then string cut and now want to add this to the output file.
    string cut --> add constant --> output text file.
    But it errors out with diff number of rows in two operations o/p

    Could someone help with poc ktr please? Need an urgent help

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

    Default

    You've got 2 answers.

    If one doesn't lead you to success, try the other.

  7. #7
    Join Date
    Feb 2017
    Posts
    4

    Default

    Quote Originally Posted by marabu View Post
    You've got 2 answers.

    If one doesn't lead you to success, try the other.
    Second answer will not work as based on header I need to cut-off other fields as fixed length.

    Thank you for your time though!
    Last edited by annanta; 03-02-2017 at 09:01 AM.

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

    Default

    Quote Originally Posted by annanta View Post
    Second answer will not work.
    I was so sure it would work.
    I even did a test run, which seemed to work on my machine.
    Silly me.

    Name:  219834-1.png
Views: 2407
Size:  8.3 KB

    Name:  219834-2.png
Views: 2397
Size:  4.1 KB
    Attached Files Attached Files
    So long, and thanks for all the fish.

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.