Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Assign the contents of a variable to a filename

Status
Not open for further replies.

peteschulte

IS-IT--Management
Nov 21, 2008
41
US
Hello FoxPro Experts,

I want to use the contents of lcFilename to name or create a file and copy report numbers from a Db field to that file.
Code:
lcToday = dtos(Date())

lcFilename = lcToday + "_IVR"

? lcFilename

...displays 20081205_IVR. So far so good.


Code:
copy to \\Web\H\Remit\KEY\lcFilename SDF FIELDS email_conf FOR clientid = 'KEY' and !empty(confirmati) and posting_dt = Date()

Used this way or as 'lcFilename' with quotation marks, it still names the file lcFilename rather than 20081205_IVR. (SDF creates a System Data File with 51 chars/line and other characteristics.)

Any suggestions? I tried creating it locally with AR-PostingFile = fcreate(lcfilename) but it's just trading one variable for another, same problem.

With Rename I ran into the same problem of assigning the contents of the variable to the filename.
Thank you,
Peter
 
Here's what worked but left me with a new problem.

Code:
("\\Web\H\Remit\KEY\" + lcFilename)
--just the right combination of parens, quotes and the plus sign. Here is the full line.

Code:
copy to ("\\Web\H\Remit\KEY\" + lcFilename) SDF FIELDS email_conf FOR clientid = 'KEY' and !empty(confirmati) and posting_dt = Date()

Now, how can I make it do that and add NO FILE EXTENSION? This file is being created for FTP by an automated process. The absence of a file extension is a requirement. Otherwise it has to be done manually every day.

If you can help, thanks very much!
Peter
 
Have you used the JUSTSTEM() command?

It should result in filename without the extension.

Good Luck,
JRB-Bldr

 
I think copy to will always add ane xtension matching the type. How about RENAME after you generated the file?

Also adding a dot at the end of the file name without a furter extension works for me.

Bye, Olaf.
 
Thanks to All,
I used your solution, Mike. It was the first one I tried!
Peter
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top