[How to] add a header line into a flat file on xDI and rename the file
Q
Quentin. leprovost-prestataire
started a topic
7 months ago
Hi,
I've got a XDI mapping who generate a flat file with several columns (10)
I want to add on the top of this file a header line with a different number of column like the name of the file and the current date. Have you got any idea of how to do ?
I also want to rename this generated file with a calculate name (with the current date for example). I don't understand how can I use a variable on the metadata physical name of the file. How can I rename a generated file on the mapping ?
Thank's for your help
Quentin
Best Answer
M
Mathias Bonnargent
said
7 months ago
Hi Quentin,
To achieve this, you can:
1.Create a Mapping
2.Specify the name of the file with the above syntax
%x{md:formatDate('yyyyMMdd-HHmmss')}x%.csv
3. Create a Process, with the Mapping and File>WriteTxFile action
Drag a drop the File metadata on WriteTxtFile action
Select "Text Write Append" > Before (to add a header, After to add a footer)
In the Expression Editor window, enter the text of the header line inserted
The result
Best regards,
1 Comment
M
Mathias Bonnargent
said
7 months ago
Answer
Hi Quentin,
To achieve this, you can:
1.Create a Mapping
2.Specify the name of the file with the above syntax
%x{md:formatDate('yyyyMMdd-HHmmss')}x%.csv
3. Create a Process, with the Mapping and File>WriteTxFile action
Drag a drop the File metadata on WriteTxtFile action
Select "Text Write Append" > Before (to add a header, After to add a footer)
In the Expression Editor window, enter the text of the header line inserted
Quentin. leprovost-prestataire
Hi,
I've got a XDI mapping who generate a flat file with several columns (10)
I want to add on the top of this file a header line with a different number of column like the name of the file and the current date. Have you got any idea of how to do ?
I also want to rename this generated file with a calculate name (with the current date for example). I don't understand how can I use a variable on the metadata physical name of the file. How can I rename a generated file on the mapping ?
Thank's for your help
Quentin
Hi Quentin,
To achieve this, you can:
1.Create a Mapping
2.Specify the name of the file with the above syntax
%x{md:formatDate('yyyyMMdd-HHmmss')}x%.csv
3. Create a Process, with the Mapping and File>WriteTxFile action
Drag a drop the File metadata on WriteTxtFile action
Select "Text Write Append" > Before (to add a header, After to add a footer)
In the Expression Editor window, enter the text of the header line inserted
The result
Best regards,
Mathias Bonnargent
Hi Quentin,
To achieve this, you can:
1.Create a Mapping
2.Specify the name of the file with the above syntax
%x{md:formatDate('yyyyMMdd-HHmmss')}x%.csv
3. Create a Process, with the Mapping and File>WriteTxFile action
Drag a drop the File metadata on WriteTxtFile action
Select "Text Write Append" > Before (to add a header, After to add a footer)
In the Expression Editor window, enter the text of the header line inserted
The result
Best regards,
2 people like this
-
File external resolver with encrypted value
-
Timeout on Mapping/Webservice call
-
UNIQUE TEMP TABLE NAMES
-
Previous step name from a sub-process of execute delivery
-
Dropping multiple tables at once in XDI
-
Freeze Designer and corrupted workspace
-
FileWait/Move/Copy: FileInclude with space
-
Loop excel files
-
Change SVN user in the Designer
-
How to Specify the JVM used by the Designer?
See all 58 topics