- Posts: 17
- Thank you received: 0
Creation of an output file has a sequence number as part ot the name
12 years 3 months ago #3005
by Kurt
Hi
I have a requirement where the creation of an output file from an extract process that runs each day has a sequence number as part of the file name.
In particular that the sequence number increments for each run – an example would be as follows –
-the file name created for Monday’s run would be “Inventory035.csv”
- the file name created for Tuesday’s run would be “Inventory036.csv”
- the file name created for Wednesday’s run would be “Inventory037.csv”
I have been looking through the options of the Advanced ETL Processor to see if there is a facility that would enable this form of file name creation.
Can you point me to a function that would assist with this form of file name control?
Regards,
Kurt
I have a requirement where the creation of an output file from an extract process that runs each day has a sequence number as part of the file name.
In particular that the sequence number increments for each run – an example would be as follows –
-the file name created for Monday’s run would be “Inventory035.csv”
- the file name created for Tuesday’s run would be “Inventory036.csv”
- the file name created for Wednesday’s run would be “Inventory037.csv”
I have been looking through the options of the Advanced ETL Processor to see if there is a facility that would enable this form of file name creation.
Can you point me to a function that would assist with this form of file name control?
Regards,
Kurt
Please Log in or Create an account to join the conversation.
12 years 3 months ago #3006
by Kurt
Replied by Kurt on topic Re: Creation of an output file has a sequence number as part ot the name
Hi
Any progress on the example routine for the CSV file sequence numbering?
Regards
K
Any progress on the example routine for the CSV file sequence numbering?
Regards
K
Please Log in or Create an account to join the conversation.
12 years 3 months ago #3007
by admin
Mike
ETL Architect
Replied by admin on topic Re: Creation of an output file has a sequence number as part ot the name
Looking at it now
Mike
Mike
Mike
ETL Architect
Please Log in or Create an account to join the conversation.
12 years 3 months ago #3008
by Kurt
Replied by Kurt on topic Re: Creation of an output file has a sequence number as part ot the name
Hi Mike
Thank you – I look forward to your example.
I tried a number of approaches but could not manipulate the variable – I could specify a variable that contained a sequence number and have it append to the CSV file name, but could not get a routine that would increment the variable containing the sequence number.
Best Wishes,
Kurt
Thank you – I look forward to your example.
I tried a number of approaches but could not manipulate the variable – I could specify a variable that contained a sequence number and have it append to the CSV file name, but could not get a routine that would increment the variable containing the sequence number.
Best Wishes,
Kurt
Please Log in or Create an account to join the conversation.
12 years 3 months ago #3009
by admin
Mike
ETL Architect
Replied by admin on topic Re: Creation of an output file has a sequence number as part ot the name
Make sure that you are using latest version
create new package
add script object
Use this as the script
var FileHandle: Integer;
FileName: string;
I: Integer;
Begin
FileName:='c:\1.txt';
if FileExists(FileName) then
begin
FileHandle:=FileOpen(FileName,fmOpenReadWrite);
FileRead(FileHandle,I,4);
I:
+1;
FileSeek(FileHandle,0,0);
FileWrite(FileHandle,I,4);
FileClose(FileHandle);
end
else
begin
I:=1;
FileHandle:=FileCreate(FileName,fmOpenWrite);
FileWrite(FileHandle,I,4);
FileClose(FileHandle);
end;
SetVariable('<file_id>',inttoStr(I));
Result:
;
end;
Than use <file_id> as a part of the file name
Mike
create new package
add script object
Use this as the script
var FileHandle: Integer;
FileName: string;
I: Integer;
Begin
FileName:='c:\1.txt';
if FileExists(FileName) then
begin
FileHandle:=FileOpen(FileName,fmOpenReadWrite);
FileRead(FileHandle,I,4);
I:

FileSeek(FileHandle,0,0);
FileWrite(FileHandle,I,4);
FileClose(FileHandle);
end
else
begin
I:=1;
FileHandle:=FileCreate(FileName,fmOpenWrite);
FileWrite(FileHandle,I,4);
FileClose(FileHandle);
end;
SetVariable('<file_id>',inttoStr(I));
Result:

end;
Than use <file_id> as a part of the file name
Mike
Mike
ETL Architect
Please Log in or Create an account to join the conversation.