Hitachi Vantara Pentaho Community Forums
Results 1 to 3 of 3

Thread: Getting each file name as a field when reading several files in Microsoft Excel input

  1. #1
    Join Date
    Nov 2017
    Posts
    2

    Default Getting each file name as a field when reading several files in Microsoft Excel input

    Hi!

    So I have a folder with files from different sources that I need to combine and process.
    They all share the same field structure and name convention, so I am using one single input step and a regular expression to read them all.
    But the problem is that I need to identify the source of each line, and there is no way to know where they come from once I append them.
    Having one step per source is not an option because there are many sources and they vary from day to day.

    Example:
    I have these files:
    Daily_Src1_20180517.xlsx
    Daily_Src2_20180517.xlsx
    Daily_Src4_20180517.xlsx
    Daily_Src5_20180517.xlsx
    That have this structure:
    Field1,Field2,Field3
    aaaaaa,aaaaaa,aaaaaa
    aaaaaa,aaaaaa,aaaaaa
    And I want to read them with one single step and get something like this:
    Field1,Field2,Field3,Source
    aaaaaa,aaaaaa,aaaaaa,Daily_Src1_20180517.xlsx
    aaaaaa,aaaaaa,aaaaaa,Daily_Src1_20180517.xlsx
    aaaaaa,aaaaaa,aaaaaa,Daily_Src1_20180517.xlsx
    bbbbbb,bbbbbb,bbbbbb,Daily_Src2_20180517.xlsx
    ....
    Is there a way to do this?


    Thank you

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

    Default

    On the additional output fields tab, put something in the Short Filename box (eg. Source).

  3. #3
    Join Date
    Nov 2017
    Posts
    2

    Default

    Thank you very much, gutlez!

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.