Start a new topic
Answered

[How to] add a header line into a flat file on xDI and rename the file

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


Hi Quentin,



To achieve this, you can:


1.Create a Mapping 

image


2.Specify the name of the file with the above syntax


%x{md:formatDate('yyyyMMdd-HHmmss')}x%.csv

image



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


image


The result

image


Best regards,



1 Comment

Answer


Hi Quentin,



To achieve this, you can:


1.Create a Mapping 

image


2.Specify the name of the file with the above syntax


%x{md:formatDate('yyyyMMdd-HHmmss')}x%.csv

image



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


image


The result

image


Best regards,




2 people like this
Login to post a comment