Hitachi Vantara Pentaho Community Forums
Results 1 to 8 of 8

Thread: How to dynamically use get fields option?

  1. #1

    Default How to dynamically use get fields option?

    Hello,

    I am working on a project where I am trying to take many .dbf files and save them each as their own .txt file. I am using the XBase input step and that works fine for a single file. My plan is to get all of the .dbf filenames and run each through the the input and output process. The issue is with the "Get Fields" step. I tried using the metadata injection step on Text File Output but it does not let me dynamically do "Get Fields". Is there any way to do this or something similar?

    Thanks,
    -Tyler

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

    Default

    If you don't specify a field list in step Text-File-Output, all available fields will be written automatically.
    If this doesn't solve your problem with the "Get Fields" button, tell us why.
    So long, and thanks for all the fish.

  3. #3

    Default

    Quote Originally Posted by marabu View Post
    If you don't specify a field list in step Text-File-Output, all available fields will be written automatically.
    I have been using Kettle for a few months and didn't even know that. I tested it and yes it does work, thanks!

  4. #4

    Default

    Ok I have a small issue. The data in the XBase input step is showing decimals for some values that should not have them for example like a year field. Is there some type of formatting going on just by using the Xbase input step? When I open the raw .dbf file in Excel I am not seeing those decimals.

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

    Default

    Kettle uses a default format for fields - something like 0.0
    Currently, you don't explicitly configure fields in Text-File-Output, so you can't specify a custom format there.
    If the fieldname is known, you can use a Select-Values step (tab Metadata) to change the format before the field is handed to Text-File-Output.

  6. #6

    Default

    Ok I see. I do not know the exact names of the fields as they will be different for each file. I was hoping there would be a way to just have every field be a string in the output, no matter how many there are or what the names are, if that is not possible I might have to use a manual route for converting them.

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

    Default

    I'm confident a JDBC driver will serve you good.
    You still can retrieve columns anonymously like "SELECT * FROM ${TABLE}" and the driver will do a better job at deriving a field format.
    I just tested with Caigen's DBF driver and HXTT DBF.
    Another way would be to write some Java code using one of the scripting steps.
    Still another way would be to use a DBF-to-CSV export tool.

  8. #8

    Default

    Thanks for the tips. I tried using some of the JDBC drivers but got blocked. I ended up copying every filename into Excel and then running a VBA script that opens each .dbf file and saves it as .txt.

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.