Hello everyone here in the forum..
I have to create a file whose name is variable which means for every time a processing report is run, a file with varaible name should get generated into a drive.
I have looked for variable file name in the forum but not able to get any clue here.
If is a static file name, for e.g., LSRETAIL.txt then we can use..
OutFileName Text 200
OutFile File
OutFileName := 'C:\LSRETAIL.txt';
OutFile.CREATE(OutFileName); //would create the file
But my problem is every time a new file should get generated in to some temp folder, the name being included with current date,current time,terminal no., transaction no. etc.
May be I am missing the basics here but will be very thankful if I get some solution for this.
Thanks in advance for all.
Dilip
Falling down is not a defeat..defeat is when you refuse to get up.
0
Comments
reportTime := TIME;
timeText := FORMAT(TODAY,0,'<Day>_<Month>_<Year4>');
timeText += FORMAT(reportTime,0,'<Hours24,2>_<Minutes,2>_<Seconds,2>');
fileName := fileName + timeText + '.txt';
Is this close to what you need?
TVision Technology Ltd
Because if you assign a path like this
OUtFileName := 'C:\fileName.txt';
OutFile.Create(OutFileName); //would create the file name with fileName.txt but not with value stored in fileName varaible.
Could you please mention the line of code for assigning a file name(which is stored in fileName varaible) along with the path(suppose if the file need to be created in C colon like C:\XXXXXXXXX.txt)
Will be wiating for your valuable reply.
Thanks.
Falling down is not a defeat..defeat is when you refuse to get up.
Declare the following text variables:
pathName, fileName,fileStartName, timeText
Declare myTime as time. Then Do:
pathName := 'c:\outpoutfiles\'; <- Or any directory you want.
fileStartName := 'LSRETAIL';
myTime := TIME; <- Get the current time.
timeText := FORMAT(TODAY,0,'<Day>_<Month>_<Year4>');
timeText += FORMAT(reportTime,0,'<Hours24,2>_<Minutes,2>_<Seconds,2>'); <- These two lines give timeText the date and time.
fileName := pathName + fileStartName + timeText + '.txt'; <- this concatenates the texts
Then : OutFile.CREATE(fileName);
Play around with this a bit to make it suit your needs...
Falling down is not a defeat..defeat is when you refuse to get up.