Hitachi Vantara Pentaho Community Forums
Results 1 to 9 of 9

Thread: créer un fichier dynamique sur kettle

  1. #1

    Question créer un fichier dynamique sur kettle

    Salut,
    j'ai une table qui contient 10 lignes et 3 champs (ch1, ch2 et ch3), je veux créer pour chaque ligne un fichier csv dont le nom est le contenu du champs A?
    nom_fichier = ch1.valeur (cad je dois avoir 10 fichier)

    est c possible sur kettle?
    c urgent s'il vous plait
    merci d'avance

  2. #2
    Join Date
    May 2006
    Posts
    4,882

    Default

    You have a file with 10 lines, 3 fields and 1 field contains a name of a file to be created.

    Sure it's possible but it requires several transformations and jobs. Don't have the time now but if no-one else replies I'll make you a small sample.

    Regards,
    Sven

  3. #3

    Default

    thank you for your attention

  4. #4
    Join Date
    May 2006
    Posts
    4,882

    Default

    Try following... unzip the attachment and run main job.kjb... have a look at the input file.txt and the resulting output files.

    Regards,
    Sven
    Attached Files Attached Files

  5. #5

    Thumbs up thanks

    thank you very much

  6. #6

    Default

    Hi,

    if Ihave in the table this stucture:
    ch1 | ch2
    A | 1
    A | 2
    A | 3
    B | 1
    B | 2
    B | 3

    and I want to have as a result two files (xls or csv):
    namefile1 : A , we have 3 lignes (1,2,3)
    namefile2 : B , we have 3 lignes (1,2,3)

    I hope that you understand me

    Thanks a lot

  7. #7
    Join Date
    Nov 1999
    Posts
    9,729

    Default

    You need to solve this one with a job.
    First you need to get the distinct values for ch1 from the base de données.
    Then you need to loop over those values in the job by
    1) sending the distinct values (A, B) to the step "copy rows to result". That is the first job entry: a transformation.
    2) create a "Job" job entry that you execute for each result row. (option)
    2a) in that job you first set a variable (Get rows from result --> set variable) FILENAME
    2b) create a transformation job entry where you read from your table:
    Code:
    SELECT ch2 FROM someTable WHERE ch1='${FILENAME}'
    Send the data to a text file output with filename set to ${FILENAME}

    That should do the trick.

    Bonne chance,

    Matt

  8. #8

    Default

    merci MattCasters,

    mais j'ai pas bien compris votre solution, je suis encore debutante


    Merci

  9. #9
    Join Date
    Nov 1999
    Posts
    9,729

    Default

    As as starting point, look at this sample job : samples/jobs/process all tables/Process all tables.kjb

    HTH,

    Matt

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.