HomeForum
Welcome, Guest

Creation of an output file has a sequence number as part ot the name
(1 viewing) (1) Guest
  • Page:
  • 1

TOPIC: Creation of an output file has a sequence number as part ot the name

Creation of an output file has a sequence number as part ot the name 10 months, 4 weeks ago #3005

  • Kurt
  • OFFLINE
  • Fresh Boarder
  • Posts: 13
  • Karma: 0
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

Re: Creation of an output file has a sequence number as part ot the name 10 months, 3 weeks ago #3006

  • Kurt
  • OFFLINE
  • Fresh Boarder
  • Posts: 13
  • Karma: 0
Hi

Any progress on the example routine for the CSV file sequence numbering?

Regards
K

Re: Creation of an output file has a sequence number as part ot the name 10 months, 3 weeks ago #3007

  • admin
  • OFFLINE
  • Moderator
  • Posts: 2182
  • Karma: 12
Looking at it now

Mike

Re: Creation of an output file has a sequence number as part ot the name 10 months, 3 weeks ago #3008

  • Kurt
  • OFFLINE
  • Fresh Boarder
  • Posts: 13
  • Karma: 0
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

Re: Creation of an output file has a sequence number as part ot the name 10 months, 3 weeks ago #3009

  • admin
  • OFFLINE
  • Moderator
  • Posts: 2182
  • Karma: 12
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:=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:=I;
end;

Than use <file_id> as a part of the file name

Mike
  • Page:
  • 1
Time to create page: 0.18 seconds

Testimonials

"DBSL software makes it much easier for us to enable new customers for automatic order processing. This alone sets us apart from the competition."

M. Clock, Director,
Clock Logistics

User Login

You only need to log in or register to use our support forum



Our customers

BP

BBC

HSBC


Databases we work with

Go to top