lcFolderName = "c:\MyDir" + substr(a,1,3)
md (m.lcFolderName)
I would advise you to use meangful variable names instead of a, b, etc. for several reasons:
1. Maintenance
2. letters a-j are reserved for work areas
If you want to use variable in the SQL, it depends on the location, e.g.
lcTable = 'c:\MyDir\MyTable'
lcNewTable = 'c:\MyDir\MyNewTable'
lcWhere = "MyIntegerField = 5"
select * from (m.lcTable) where &lcWhere into table (m.lcNewTable)
A simple example
lcFolder = "X" + SUBSTR(myvar,1,3)
MD (lcFolder) && to create a folder under the current folder. You could use absolute path too
* use ON ERROR to make sure the folder creation did not fail (e.g. write permissions, parent folder not found, folder already exists)
SELECT field1, field2 FROM myfile INTO TABLE (lcfolder + "mytable")
HTH
mrfitness wrote:
Thank you so much Naomi...you've been a great help!
Can you explain the meaning/functionality of 'md' and '(m.lcfoldername)'
MD is short for MKDIR
(m.lcfoldername) is a named-variable where you are using indirection to tell the system to create a folder using the contents of the variable at runtime.
md is a command to create a directory, AFAIK the same as in DOS. You can also use MKDIR command.
When you put variable in parents, it means, that it should be evaluated and it is called name expression. It is sort of a macro, but it is quicker than macro and easier to understand.
On a for profit website I can not name here there is a FAQ describing difference between macros, name expressions and evaluate. I hope I can post a link, though ![]()
Simplest way
local lnError
lnError = 0
on error lnError = error()
md (m.lcMyDir)
if m.lnError <> 0
* Error occurred, analyze it
endif