Skip to main content
Announcements
SYSTEM MAINTENANCE: Thurs., Sept. 19, 1 AM ET, Platform will be unavailable for approx. 60 minutes.
cancel
Showing results for 
Search instead for 
Did you mean: 
PAGESC
Contributor
Contributor

Generation fichier en 3 parties depuis un tmap commun

Bonjour,

 

Je souhaiterais générer un seul fichier texte avec une ligne header, un contenu et une ligne fin. Comme par exemple  :image 1

Mon problème avec le job actuel c'est qu'il duplique la 1ere et la dernière ligne d'autant de lignes que le contenu (soit 3833 cf. image 2).

Est-il possible de restreinte le nombre de ligne à 1 en sortie du tMap pour mes deux composants tFileOutputDelimited ?

 

Merci par avance pour votre aide.

 

0683p000009M8mj.jpg0683p000009M8SW.jpg

Labels (3)
1 Solution

Accepted Solutions
TRF
Champion II
Champion II

For sure!

Use a Numeric.sequence into your tMap and add a filter for both the header and footer output flows like this:0683p000009M8mo.png

Should work

View solution in original post

6 Replies
TRF
Champion II
Champion II

For sure!

Use a Numeric.sequence into your tMap and add a filter for both the header and footer output flows like this:0683p000009M8mo.png

Should work

PAGESC
Contributor
Contributor
Author

Many thanks for your help.
I just tried it and it works as I want !
PAGESC
Contributor
Contributor
Author

Hello,

 

I've Added a tSetGlobalVar as 1st output of the tMap to define the name of the file built from the others outputs.

But the execution of the job split the output into 2 files, one named "null" and the second has the expected name defined by tSetGlobalVar.

I would like to plan the execution of the outputs in order to wait the compilation of tSetGlobalvar before to start buiding the content.

 

Thanks in advance for your help.

 


Talend1.PNG
TRF
Champion II
Champion II

Because output files are opened or created when the subjob starts and before the flow itself starts.

So, if the output filename doesn't depend of the query result, set the global variable before the subjob.

Else,  add a tFlowToIterate after the tMap, then restart the flow with a tFixedFlowInput (in which you will have to populate each field with the corresponding global variable created by the tFlowToIterate).

PAGESC
Contributor
Contributor
Author

I tried to used these components ( tFlowToIterate  and tFixedFlowInput) but I have not been able to make it work as it should (badly positioned or poorly configured )

I thinked to a workaround solution which is working, I put the same  fixed name in the all outputs (tFileOutputDelimited) and at the end I add a tFileCopy to rename the file with the good filename.

Thank you for your answer.

PAGESC
Contributor
Contributor
Author

Hello,

 

There is a bug with my job, the number of lines in the "ecriture_detail" is not right, there is 1 line missing.

I think it's due to the Numeric.sequence added in the first step of file building, it uses one line that is inferred in next step.

As you could see in the Screenshot, I should have 1 line for the header, 3944 lines for the content and 1 line for the end, but in the final file I obtained only 3943 lines in the detail. How can I use Numeric.Sequence to avoid this kind of error ?

 

Many thanks for your help.

Céline.


Screenshot_Talend.png