Hitachi Vantara Pentaho Community Forums
Results 1 to 9 of 9

Thread: Creating a .dat file. Header and body with distinct infraestructure.

  1. #1

    Default Creating a .dat file. Header and body with distinct infraestructure.

    Hi All, Im trying to creat a .dat file with a header (2 rows with 3 data per row) and a body with thousands of data differents from header (5 data per row).Like this:

    Name1,Surname1,Phone1

    Name2,Surname2,Phone2
    a1;b1;c1;d1;e1
    a2;b2;c2;d2;e2
    .....................
    aN;bN;cN;dN;eN

    I have the data from header and from the body in differents tables inputs, but I dont know how to merge it in a unique archive .dat with that specific format.


    Thanks a million for you time.
    Last edited by Moterosk; 06-07-2018 at 05:05 AM.

  2. #2

    Default

    Somebody can support me?

    Thanks in advance.

  3. #3
    Join Date
    Aug 2016
    Posts
    290

    Default

    A couple of questions:

    1) Why are you writing two header rows?
    2) Why does data have different amount of columns than the header(s)?

    Other than that, it seems quite simple. Send the stream with the two header rows to a write to file step. Send the stream with the data rows to a block step, waiting for the write to file step to finish. Then send the rows from the block wait step to a different write to file step. Case solved?

  4. #4
    Join Date
    Nov 2009
    Posts
    688

    Default

    With a dat file you mean a txt file?
    - First write the data to a file.
    - Then write the body with txt file output to the same file and check "Append" in the Content tab

  5. #5
    Join Date
    Aug 2016
    Posts
    290

    Default

    Would you be able to mix different field count with append and the same txt file output?

  6. #6

    Default

    Append streams step in transformation might help you. Check and let me know.
    Regards,
    Dileep
    Mail ID

  7. #7
    Join Date
    Aug 2016
    Posts
    290

    Default

    How would you be able to append streams with different amount of fields?

  8. #8

    Default

    First of all is to say Thanks a million for your answers, and sorry for delayed.


    Im creating a .dat archive like .the archives created by a datalogger.


    That kind of archive has this structure:



    • 4 headers with metainformation about the the whole data in the body, I mean:




    • 1 header with the information about date.
    • 1 header with the information about the columns of the body data.
    • 1 header with the information about the archive
    • 1 header with control information .




    • The body with thousands of data.



    First of all is to say Thanks a million for your answers, and sorry for delayed.


    Im creating a .dat archive like .the archives created by a datalogger.


    That kind of archive has this structure:


    4 headers with metainformation about the the whole data in the body, I mean:


    1 header with the information about date.
    1 header with the information about the columns of the body data.
    1 header with the information about the archive
    1 header with control information .


    The body with thousands of data.


    At the moment I have solved it creating a text file with extension .dat with the header 1, and in the following steps adding the information in that same archive using the add option.I don´t know if there is another better option, but really thanks a million.


    Now I have another problem, and is this:


    In the first step of a transformation I have a input data with a sql like this:


    Select distinct tableName from AmountData.




    I have 109 tableName differents (By the way those tables exists).


    I want to use each tableName field value in 4 inputs data steps wtihin the same transformation, I mean:



    • Step 1 (first iteration):




    • Select distinct tableName from AmountData

    Result: tableName= Datalogger1



    • Step 2(first iteration):



    • Select * from Datalogger1_Header1 (Concatenated tableName with the text _header1)




    • Step 3(first iteration):




    • Create a file called "Datalogger1", with the data from step 2



    • Step 4(first iteration):



    • Select * from Datalogger1_Header2 (Concatenated tableName with the text _header2)




    • Step 5(first iteration):




    • Append the data from step 4 to the file "Datalogger1".



    • Step 6(first iteration):



    • Select * from Datalogger1_Header3 (Concatenated tableName with the text _header3)




    • Step 7(first iteration):




    • Append the data from step 6 to the file "Datalogger1".



    • Step 8(first iteration):



    • Select * from Datalogger1_Header4 (Concatenated tableName with the text _header4)




    • Step 9(first iteration):




    • Append the data from step 8 to the file "Datalogger1".



    ..............


    with the 109 Iterations / Tablenames.




    Im trying to solve it with parameters, or getting data from previously step option, but Im not lucky at the moment, I can´t get the tableName since the first step, some ideas???


    Thanks a million !!!!!

  9. #9

    Default

    I have found the solution with this example:

    https://forums.pentaho.com/attachmen...2&d=1284798588

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.