Dynamic File names

Dynamic file names is a quite common task and there are multiple ways of doing it

It is possible to use calculated filenames by placing calculation inside {}

Note:

Only one pair of {} is allowed

For example:

This will use today date to generate the filename

C:\Data\{GetSystemDate('YYYYMMDD')}.txt

and that one will use yesterdays date

C:\Data\{DecDateS(GetSystemDate('YYYYMMDD'),'YYYYMMDD','DAY',1)}.txt

<CommonDocumentsDir>\DBSL\{GetSystemVariable('SOURCE_FILE_NAME')}.txt

Note:

<CommonDocumentsDir> is a variable and will be replaced with an actual value before execution

C:\Data\{GetVariable('<file_name>')}.txt

This calculation will create a new file every time [F001] is changed

begin
if GetVariable('<file_name>')<>[F001] then record changed
begin
SetVariable('<file_name>',[F001]);
SourceChanged;
creating new file
end;
Result:='test';
end;

Default repository has a number of useful examples

Building a complex file name

For more technologies supported by our ETL Software see Advanced ETL Processor Versions and Visual Importer ETL Versions

Confused? Ask question on our ETL forum

  • aetl/dynamic_file_names.txt
  • Last modified: 12/07/2015 18:37
  • by admin