Domanda

i have an issue where i get flat file with date and time extension to flat file name like test_28-10-2012.txt

I can get the flat file name in mapping through checking the AddCurrentlyProcessedFileNameproperty in Source Analyzer,from there i can do my logic but my question is

how can i dynamically give the flat file name in Source file name property of session.

È stato utile?

Soluzione

One way to do this is to use indirect sources. You can configure your session to use indirect sources, wherein the source file names are coming from a text file (each entry in the listfile is a source file session will read).

Then you can arrange your code to add that dynamic filename to that listfile.

Altri suggerimenti

You can parametrize the name of the source file - in the session properties replace the hard-coded Source filename value with a parameter (e.g. $$SOURCE_FILENAME) and define its value in the parameter file:

$$SOURCE_FILENAME=test_28-10-2012.txt

From IPC help:

Creating Target Files by Transaction

You can generate a separate output file each time the Integration Service starts a new transaction. You can dynamically name each target flat file.

To generate a separate output file for each transaction, add a FileName port to the flat file target definition. When you connect the FileName port in the mapping, the Integration Service creates a separate target file at each commit. The Integration Service names the output file based on the FileName port value from the first row in each transaction. By default, the Integration Service writes output files to $PMTargetFileDir.

Use a pre-session script that creates a file list.

Windows

dir /b part_of_file_name*.txt > FILELIST_NAME.LST

UNIX

ls part_of_file_name* > FILELIST_NAME.LST

In Workflow Manager edits the session task and go to the Mapping tab. Select the flat file source. Under Properties, enter the list file name (“FILELIST.LST”). Under Source filename change the value for Source file type to Indirect.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top